NGINX关于配置PATHINFO
最近在群里发现有很多小白不会配置pathinfo现贴出来配置代码照着配置就可以了
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
server
{
listen 80;
server_name xxx.com
root /alidata1/wwwroot/xxx;
index index.html index.htm index.php;
//这里是关键
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include /usr/local/nginx/conf/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;
}
access_log /home/wwwlogs/access.log access;
}
|