在Windows上使用nginx和php-cgi时,出现上述错误。 这是我的nginxconfiguration:
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80 default; server_name localhost; charset utf-8; root ..\www; index index.php index.html index.htm; error_page 500 502 503 504 /50x.html; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; root ..\www; try_files $uri =404; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\. { access_log off; log_not_found off; deny all; } location / { if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; } } } }
任何人都可以看到有什么不对吗?
编辑:这是一个请求日志。
127.0.0.1 - - [30/Apr/2012:00:04:35 +0100] "GET /hi.php HTTP/1.1" 404 36 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120428 Firefox/15.0a1"
请仔细阅读文档
configuration文件中的path必须使用正斜杠以UNIX风格指定:
access_log logs/site.log; root C:/web/html;
尝试在您的根指令中使用正斜杠/
而不是反斜杠\
。
另外,我不认为你需要在你的location ~ \.php$ {
block。
没有任何logging在错误文件中。 只是试过你的build议,现在我得到一个nginx 404页面。