配置nginx时一直报错:file not found
错误日志:
[error] 12691#0: *6 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.168.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.168.133"
改成下面的配置恢复正常,/datao/htdocs/thinkphp为根目录
{ listen 80; server_name www.tp.com; access_log /data1/logs/tp_access.log myformat; index index.html index.htm index.php; root /datao/htdocs/thinkphp; location ~ \.php { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; 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 SCRIPT_FILENAME /data0/htdocs/thinkphp/$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; } }