nginx配置thinkphp3.1.3
2021/02/24    标签: thinkphp3.1.3    nginx配置thinkphp3.1.3   

.conf

server {
        listen       8510;
        server_name  plays;
        # 文件夹为think开头或者tp开头服务器报错
        root   "C:\Users\Administrator\Desktop\study_tp_3.1.3";
        include "C:\Users\Administrator\Desktop\study_tp_3.1.3\.htaccess";
        if (!-e $request_filename){
            rewrite ^/(.*)$ /index.php/$1 last;
            break;
        }
        location / {
            index index.html index.htm index.php;
            #try_files $uri $uri/ /index.php$is_args$args;
            #autoindex  on;
        }
        location ~ \.php(.*)$ {
            fastcgi_pass   phpfastcgi_proxy;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
                expires      30d;
        }
 
        location ~ .*\.(js|css)?$
        {
                expires      12h;
        }
}

.htaccess

# nginx rewrite rule
# rewrite ^/q_([^-]+)-([0-9]+).html$ /search.php?q=$1&page=$2 last;
rewrite ^/list/([0-9]+)$ /list/index/?id=10&type=0;
rewrite ^/list/([0-9]+)/([0-9]+)$ /list/index/?id=10&type=12 last;

rewrite ^/vod-([0-9]+)-([0-9]+).html$ /play.php?videoid=$1&movieOrder=$2 last;


rewrite ^/vue/(.*)$ /vue/index.php last;
# end nginx rewrite rule


thinkphp3.1.3中URL_ROUTE_RULES 路由配置会导致页面301跳转,不知道是不是配错了还是本该如此