1、alias后访问php文件,php被当作普通文本处理
问题配置如下:
set $root /usr/nginx/;
location ^~ /book {
#root $root/html/books;
alias $root/html/books/;
index index.php;
}
location ~ /book/.+\.php.*$ {
if ($fastcgi_script_name ~ /book/(.+\.php.*)$) {
set $valid_fastcgi_script_name $1;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $root/html/books/$valid_fastcgi_script_name;
include fastcgi_params;
}
location ~ \.php$ {
root $root/html/;
fastcgi_pass localhost:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $root/html/$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
解决方案
暂无
No input file specified
在/etc/php/fpm/php.ini 的open_base_dir参数中加上要访问的站点根目录
然后重启php-fpm
kill -USR2 [pid]
file not found
通常是nginx.conf配置错误,仔细核对
网友评论