阿喆的博客空间 > 服务器运维 > linux服务器 >

thinkphp5的nginx配置

 作者:阿喆 时间:2018-04-15

thinkphp5的nginx配置

server {
        listen       80;
        server_name  www.tp5.com;
        root   "E:/PHPstudy/WWW/study/public";
        location / {
            index  index.html index.php;
            if (!-e $request_filename) {    
                rewrite ^(.*)$ /index.php?s=$1 last;    //路径隐藏index.php
                break;    
            }    
        }
        location ~ \.php {    #去掉$   
            fastcgi_pass   127.0.0.1:9000;    
           fastcgi_index index.php;    
           include fastcgi_params;    
           set $real_script_name $fastcgi_script_name;    
           if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {    
               set $real_script_name $1;    
               set $path_info $2;    
           }    
           fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;    
           fastcgi_param SCRIPT_NAME $real_script_name;    
           fastcgi_param PATH_INFO $path_info;   //支持path_info
        }
       
}

上一篇:没有了