后端用的thinkphp3.二.3框架,若何怎样你是其他的措辞或者者,注重持重修正高
server {
listen 80;
server_name www.morgen.club;
#charset koi8-r;
#access_log logs/host.access.log main;
登录后复造
网站根目次
location / {
root html;
index index.html index.htm;
#设施造访陈设
set $source_device 'index';
#断定为脚机客户端或者ipad
if ($http_user_agent ~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)) {
set $source_device 'phone';
}
#根目次
if ($request_uri ~* ^/$){
rewrite ^(.*)$ /index.php必修s=/home/$source_device/index.html last;
break;
}
#电脑尾页
if ($request_uri ~* ^/home/index/index.html$) {
rewrite ^/home/index/index.html$ /web/ permanent;
break;
}
#电脑尾页分页
if ($request_uri ~* ^/home/index/index/page/(\d*).html$) {
rewrite ^/home/index/index/page/(\d*).html$ /web/pages/$1/ permanent;
break;
}
#电脑尾页分类尾页
if ($request_uri ~* ^/home/index/index/cate/(\d*).html$) {
rewrite ^/home/index/index/cate/(\d*).html$ /web/cates/$1/ permanent;
break;
}
#电脑尾页分类分页
if ($request_uri ~* ^/home/index/index/cate/(\d*)/page/(\d*).html$) {
rewrite ^/home/index/index/cate/(\d*)/page/(\d*).html$ /web/cates/$1/pages/$两/ permanent;
break;
}
#电脑尾页搜刮
if ($request_uri ~* ^/home/index/index.html(.*)) {
rewrite ^/home/index/index.html(.*) /web/search必修$query_string permanent;
break;
}
#电脑书本页里
if ($request_uri ~* ^/home/index/books/book/(\d*).html$) {
rewrite ^/home/index/books/book/(\d*).html$ /web/books/$1/ permanent;
break;
}
#电脑章节页里
if ($request_uri ~* ^/home/index/contents/books/(\d*)/chapters/(\d*).html$) {
rewrite ^/home/index/contents/books/(\d*)/chapters/(\d*).html$ /web/books/$1/chapters/$两/ permanent;
break;
}
#脚机尾页
if ($request_uri ~* ^/home/phone/index.html$) {
rewrite ^/home/phone/index.html$ /phone/ last;
break;
}
#脚机尾页分页
if ($request_uri ~* ^/home/phone/index/page/(\d*)(.*)$) {
rewrite ^/home/phone/index/page/(\d*).html /phone/pages/$1/ permanent;
break;
}
#脚机尾页分类尾页
if ($request_uri ~* ^/home/phone/index/cate/(\d*).html$) {
rewrite ^/home/phone/index/cate/(\d*).html$ /phone/cates/$1/ permanent;
break;
}
#脚机尾页分类分页
if ($request_uri ~* ^/home/phone/index/cate/(\d*)/page/(\d*).html$) {
rewrite ^/home/phone/index/cate/(\d*)/page/(\d*).html$ /phone/cates/$1/pages/$两/ permanent;
break;
}
#脚机尾页搜刮
if ($request_uri ~* ^/home/phone/index.html必修(.*)) {
rewrite ^/home/phone/index.html(.*) /phone/index.html$1 permanent;
break;
}
#脚机书本页里
if ($request_uri ~* ^/home/phone/books/book/(\d*).html$) {
rewrite ^/home/phone/books/book/(\d*).html$ /phone/books/$1/ permanent;
break;
}
#脚机章节页里
if ($request_uri ~* ^/home/phone/contents/books/(\d*)/chapters/(\d*).html$) {
rewrite ^/home/phone/contents/books/(\d*)/chapters/(\d*).html$ /phone/books/$1/chapters/$二/ permanent;
break;
}
if ($request_uri ~* ^/home/book/(.*)$) {
rewrite ^(.*)$ /index.php必修s=$1 last;
break;
}
if (!-e $request_filename) {
return 404;
}
}
登录后复造
电脑涉猎器端
location /web {
root html;
index index.html index.htm;
#假设设置为脚机或者ipad
if ($http_user_agent ~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)) {
rewrite ^/web(.*) /phone$1 permanent;
}
#电脑尾页搜刮
if ($request_uri ~ ^/web/search(.*)$) {
rewrite ^(.*) /index.php必修s=/home/index/index.html last;
break;
}
#电脑尾页
set $index false;
if ($request_uri ~* ^/web$) {
set $index true;
}
if ($request_uri ~* ^/web/$) {
set $index true;
}
if ($index = true){
rewrite ^/web(.*) /index.php必修s=/home/index/index.html last;
break;
}
#电脑尾页分页
set $index_page false;
if ($request_uri ~* ^/web/pages/(\d*)$) {
set $index_page true;
}
if ($request_uri ~* ^/web/pages/(\d*)/$) {
set $index_page true;
}
if ($index_page = true){
rewrite ^/web/pages/(\d*)(.*) /index.php选修s=/home/index/index/page/$1.html last;
break;
}
#电脑分类尾页
set $cate false;
if ($request_uri ~* ^/web/cates/(\d*)$) {
set $cate true;
}
if ($request_uri ~* ^/web/cates/(\d*)/$) {
set $cate true;
}
if ($cate = true){
rewrite ^/web/cates/(\d*)(.*) /index.php选修s=/home/index/index/cate/$1.html last;
break;
}
#电脑分类分页
set $cate_page false;
if ($request_uri ~* ^/web/cates/(\d*)/pages/(\d*)$) {
set $cate_page true;
}
if ($request_uri ~* ^/web/cates/(\d*)/pages/(\d*)/$) {
set $cate_page true;
}
if ($cate_page = true){
rewrite ^/web/cates/(\d*)/pages/(\d*)(.*) /index.php必修s=/home/index/index/cate/$1/page/$两.html last;
break;
}
#电脑书本页里
set $book false;
if ($request_uri ~* ^/web/books/(\d*)$) {
set $book true;
}
if ($request_uri ~* ^/web/books/(\d*)/$) {
set $book true;
}
if ($book = true){
rewrite ^/web/books/(\d*)(.*) /index.php必修s=/home/index/books/book/$1.html last;
break;
}
#电脑章节页里
set $chapter false;
if ($request_uri ~* ^/web/books/(\d*)/chapters/(.*)$) {
set $chapter true;
}
if ($request_uri ~* ^/web/books/(\d*)/chapters/(.*)/$) {
set $chapter true;
}
if ($chapter = true){
rewrite ^/web/books/(\d*)/chapters/(.*)/ /index.php必修s=/home/index/contents/books/$1/chapters/$两.html last;
break;
}
if (!-e $request_filename) {
return 404;
}
}
登录后复造
脚机战役板端
location /phone {
root html;
index index.html index.htm;
#如何部署没有是脚机或者ipad
if ($http_user_agent !~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)) {
rewrite ^/phone(.*) /web$1 permanent;
}
#电脑尾页搜刮
if ($request_uri ~ ^/phone/search(.*)$) {
rewrite ^(.*) /index.php必修s=/home/phone/index.html last;
break;
}
#脚机尾页
set $index false;
if ($request_uri ~* ^/phone$) {
set $index true;
}
if ($request_uri ~* ^/phone/$) {
set $index true;
}
if ($index = true){
rewrite ^/phone(.*) /index.php必修s=/home/phone/index.html last;
break;
}
#脚机尾页分页
set $index_page false;
if ($request_uri ~* ^/phone/pages/(\d*)$) {
set $index_page true;
}
if ($request_uri ~* ^/phone/pages/(\d*)/$) {
set $index_page true;
}
if ($index_page = true){
rewrite ^/phone/pages/(\d*)(.*) /index.php选修s=/home/phone/index/page/$1.html last;
break;
}
#脚机分类尾页
set $cate false;
if ($request_uri ~* ^/phone/cates/(\d*)$) {
set $cate true;
}
if ($request_uri ~* ^/phone/cates/(\d*)/$) {
set $cate true;
}
if ($cate = true){
rewrite ^/phone/cates/(\d*) /index.php必修s=/home/phone/index/cate/$1.html last;
break;
}
#脚机分类分页
set $cate_page false;
if ($request_uri ~* ^/phone/cates/(\d*)/pages/(\d*)$) {
set $cate_page true;
}
if ($request_uri ~* ^/phone/cates/(\d*)/pages/(\d*)/$) {
set $cate_page true;
}
if ($cate_page = true){
rewrite ^/phone/cates/(\d*)/pages/(\d*)(.*) /index.php必修s=/home/phone/index/cate/$1/page/$两.html last;
break;
}
#脚机书本页里
set $book false;
if ($request_uri ~* ^/phone/books/(\d*)$) {
set $book true;
}
if ($request_uri ~* ^/phone/books/(\d*)/$) {
set $book true;
}
if ($book = true){
rewrite ^/phone/books/(\d*)(.*) /index.php选修s=/home/phone/books/book/$1.html last;
break;
}
#脚机书本分页页里
set $book false;
if ($request_uri ~* ^/phone/books/(\d*)/pages/(\d*)$) {
set $book true;
}
if ($request_uri ~* ^/phone/books/(\d*)/pages/(\d*)/$) {
set $book true;
}
if ($book = true){
rewrite ^/phone/books/(\d*)/pages/(\d*) /index.php必修s=/home/phone/books/book/$1/page/$两.html last;
break;
}
#脚机章节页里
set $chapter false;
if ($request_uri ~* ^/phone/books/(\d*)/chapters/(.*)$) {
set $chapter true;
}
if ($request_uri ~* ^/phone/books/(\d*)/chapters/(.*)/$) {
set $chapter true;
}
if ($chapter = true){
rewrite ^/phone/books/(\d*)/chapters/(.*)/ /index.php必修s=/home/phone/contents/books/$1/chapters/$二.html last;
break;
}
if (!-e $request_filename) {
return 404;
}
}
location ~ .xml(.*) {
root html/ttt/;
}
location ~ .txt(.*) {
root html/ttt/;
}
location ~ .gif(.*) {
root html/ttt/;
}
location ~ .jpg(.*) {
root html/ttt/;
}
location ~ .css(.*) {
root html/ttt/;
}
location ~ .js$ {
root html/ttt/;
}
location ~ .php$ {
root html/ttt;
fastcgi_pass 1二7.0.0.1:9000;
fastcgi_index index.php;
fastcgi_buffers 8 两56k;
fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
fastcgi_param script_filename $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
登录后复造
以上等于nginx如何摆设伪静态以及适配客户真个具体形式,更多请存眷萤水红IT仄台另外相闭文章!
发表评论 取消回复