#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ [^/]\.php(/|$){
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
}
1
zgk 2018-01-07 19:48:18 +08:00 via Android
我是这么写的,还可以判断 php 文件是否存在
``` server { listen 80 default_server; server_name _; root /www; index index.html index.php; location ~ \.php(/|$) { fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+?\.php)(.*)$; set $real_path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; fastcgi_param PATH_INFO $real_path_info; include fastcgi.conf; } } ``` |
2
wdd2007 2018-01-08 00:30:39 +08:00
可以解释一下么 @xiaoyanbot
|