nginx访问php文件
server { listen 80; server_name ctail.top; root /data; index index.php; #location / { # root /data; # index index.php; #} 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; } }
location / {
index index.htm index.html index.php;
#使其支持Thinkphp的rewrite模式
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ .+\.php($|/) {
fastcgi_index index.php;
#使其支持thinkphp的pathinfo模式
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
}
include fastcgi.conf;