lnmp的pathinfo规则
2021-04-28 本文已影响0人
Mracale
server {
listen 80;
root /usr/share/nginx/tpf/public;
server_name vm.tpf.com;
gzip on;
index index.php index.html index.htm index.nginx-debian.html;
#根目录下面的其他文件夹不能访问php文件
location ~* ^/(upload|static|log)/.*\.(php|php5)$
{
deny all;
}
location / {
try_files $uri $uri/ =404;
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_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
error_log /home/mracale/www.err;
access_log /home/mracale/www.log;
}