I installed nginx-1.6.2,2 on FreeBSD-9.2-RELEASE-p5 and here is my 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"

There is another root that's pointed to /usr/local/www/nginx in another server block with server_name localhost (default configuration - http://pastebin.com/caRJM20f)

Why is it taking that over my root as I specified for another server_name?


You need to add listen [IP:]80; inside of the server section in your _includes/XXX.conf file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.