查看日誌tail /var/log/nginx/error.log,提示「primary script unknown while reading response header from upstream」
~查看該虛擬主機的設定檔部分內容如下:
#fastcgi_pass remote_php_ip:9000; fastcgi_pass unix:/var/run/php5-fpm.sock _script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^ (.+?.php)(/.+)$") {
set $real_script_name $1;
set $path real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
無奈拷貝安裝nginx後有個缺省的配置文件default中的location部分,如下:
fastcgi_split_path_info ^(.+.php)(/ .+)$; # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# fastcgi_pass 127.0.0.1:9000; # -fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params;
}
以上就介紹了nginx/146 配置的虛擬主機存取提示“File not found”,包括了file not found方面的內容,希望對PHP教程有興趣的朋友有所幫助。