thinkphp5 下 的Nginx 伪静态


server {

listen 80;
server_name all.bjed.com;
root "F:wwwasdata";
location / {
index index.html index.htm index.php;
#autoindex on;
    if (!-e $request_filename) {
        rewrite  ^(.*)$  /index.php?s=/$1  last;
        break;
    }
  }

location ~ .php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
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;
}
}

thinkphp3
    server {
        ###SiteName  www.bc1.com
        listen       *:80;
        server_name  www.bc1.com;
        root         "F:/Visual-NMP-x64/www/BC1";
        #error_log    "F:/Visual-NMP-x64/logs/Nginx/wwwbc1com-error.log";
        #access_log   "F:/Visual-NMP-x64/logs/Nginx/wwwbc1com-access.log";
        autoindex    on;
        index        index.php index.html index.htm;

    location /
            {
                index index.php;
                #ThinkPHP REWRITE支持
                if (!-e  $request_filename) {
                    rewrite ^/(.*)$ /index.php?s=$1 last;
                }
                #301 跳转设置
                if ($host = 'vc.cn') {
                        rewrite ^/(.*) http://www.vc.cn/$1 permanent;
                }
            
            }        
        location ~ [^/].php(/|$)
            {
               fastcgi_split_path_info  ^(.+?.php)(/.*)$;
                if (!-f $document_root$fastcgi_script_name) {
                        return 404;
                }
                fastcgi_pass   127.0.0.1:9002;
                fastcgi_index  index.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;
            } 
    }


 
原文地址:https://www.cnblogs.com/wtcl/p/6484703.html