应用配置文件:
server {
listen 80;
server_name xxx.com;
access_log /home/wwwlogs/xxx.com_access.log;
error_log /home/wwwlogs/xxx.com_error.log;
set $root /home/wwwroot/xxx.com/public;
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root $root;
}
location / {
root $root;
index index.html index.php;
if ( -f $request_filename) {
break;
}
if ( !-e $request_filename) {
rewrite ^(.*)$ /index.php/$1 last;
break;
}
}
location ~ .+\.php($|/) {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name;
include fastcgi_params;
}
}
Access denied:
php.ini中找到 cgi.fix_pathinfo=0 改为 cgi.fix_pathinfo=1
然后再到nginx.conf中,添加 fastcgi_split_path_info ^(.+\.php)(/.+)$;
thinkphp5报input file specified:
注释 fastcgi.conf 中最后一行 如上图