我一直无法获得一个PHP脚本与Nginx的工作。 调用脚本my-url:90 / useraccessauthorization / useraccessauthorization.php给我一个404错误。
以下是我的configuration细节。 有人能让我知道我失踪了吗? 提前致谢。
编辑 :我也应该提到,运行“/etc/init.d/nginx reload”给了我结果:
重新加载nginxconfiguration:nginx:[alert]无法打开错误日志文件:open()“/var/log/nginx/error.log”失败(13:权限被拒绝)2012/05/10 16:07:13 [warn ] 18214#0:只有主进程以超级用户权限运行时,“user”指令才有意义,在/etc/nginx/nginx.conf中将忽略:1 nginx:configuration文件/etc/nginx/nginx.conf语法是好的2012/05/10 16:07:13 [emerg] 18214#0:open()“/var/run/nginx.pid”失败(13:权限被拒绝)nginx:configuration文件/ etc / nginx / nginx。 conftesting失败
/ etc / nginx / sites-available / default:
server { listen 90; root /usr/share/nginx/www; index index.html index.htm; access_log /var/log/nginx/top-secret-project.access.log; server_name localhost; location / { try_files $uri $uri/ /index.html; } location /doc { root /usr/share; autoindex on; allow 127.0.0.1; deny all; } } server { listen 90; listen my-url:90; server_name my-url; access_log /var/log/nginx/saba.access.log; location /assets/ { autoindex on; alias /home/kkaisare/Workspaces/top_secret_project/client/web/assets/; } location /private_content_server/ { alias /home/kkaisare/Workspaces/top_secret_project/store/content/private_content_server/; autoindex on; } location /production_content_server/ { alias /home/kkaisare/Workspaces/top_secret_project/store/content/production_content_server/; autoindex on; } include /etc/nginx/fastcgi_php; }
的/ etc / nginx的/ fastcgi_php:
location /useraccessauthorization/\.php$ { fastcgi_pass unix:/var/run/php-fastcgi/php.sock; fastcgi_param SCRIPT_FILENAME /home/kkaisare/Workspaces/top_secret_project/store/content/production_content_server/$fastcgi_script_name; include /etc/nginx/fastcgi_params; }
首先,你确实需要解决你的configuration问题。 如果你不是以超级用户的身份运行,那么不要试图改变成另一个用户。 但是,如果绑定到端口90,则实际上需要以root身份启动,所以要么绑定到高于1024的端口,要么以root身份启动,并让nginx通过user指令删除特权。
其次你的pid文件,因为你不是以root身份启动,所以你可能需要确保你的实际用户有权读取你的init脚本创build的pid文件。 直到你解决这个问题,你不能dynamic地重新加载你的configuration。
最后,当以上是固定的。 然后改变你的位置
location /useraccessauthorization/\.php$ {
至
location ~ ^/useraccessauthorization/.+\.php$ {
你的/etc/nginx/nginx.conf是什么样的? 从它的外观你的错误是因为你不重新加载nginx作为所有者或超级用户。
仔细检查nginx用户拥有的那些文件的权限(通常是www / www),并且sudo /etc/init.d/nginx reload也会修复用户指令错误。