我在FreeBSD-9.2-RELEASE-p5上安装了nginx-1.6.2,2 ,这是我的configuration:
# tail -2 nginx.conf include _includes/*.conf; } # cat _includes/XXX.conf server { server_name XXX; root /home/user/XXX/; index index.php; include _includes/_location-php.include; } # cat _includes/_location-php.include location ~ \.php$ { include fastcgi_params; fastcgi_intercept_errors on; fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } # tail -1 /var/log/nginx-error.log 2014/11/17 11:45:59 [error] 82950#0: *6 open() "/usr/local/www/nginx/admin.php" failed (2: No such file or directory), client: XX.XX.XX.XX, server: localhost, request: "GET /admin.php HTTP/1.1", host: "XXX" #
在另一个服务器块中有另一个指向/usr/local/www/nginx root ,其中server_name localhost (默认configuration – http://pastebin.com/caRJM20f )
为什么它是通过我为另一个server_name指定的root ?
你需要添加listen [IP:]80; 在_includes/XXX.conf文件中的server部分内部。