403 error for one of my server blocks

nginxmike nginx-forum at nginx.us
Sun Jan 12 04:04:35 UTC 2014


Hi, 

I installed nginx on an ubuntu server and then followed this tutorial (which
I'll quote from) to setup server blocks
https://digitalocean.com/community/articles/how-to-configure-single-and-multiple-wordpress-site-settings-with-nginx
.(I don't do any of the WordPress config in that article). It uses a
common.conf that the server blocks inherit from. 

In one of my server blocks, I setup a basic index.html page and set my
domain name for the server name in the server block file.

In the directory for my other server block, I setup a node app. That's the
one where I'm getting the 403 error.

Anyone know why this might be happening and how I might debug and/or fix
it?


server block

server {
    # URL: Correct way to redirect URL's
    server_name demo.com;
    rewrite ^/(.*)$ http://www.demo.com/$1 permanent;
}
server {
    server_name www.demo.com;
    root /home/demouser/sitedir;
    access_log /var/log/nginx/www.demo.com.access.log;
    error_log /var/log/nginx/www.demo.com.error.log;
    include global/common.conf;
}



common.conf

# Global configuration file.
# ESSENTIAL : Configure Nginx Listening Port
listen 80;
# ESSENTIAL : Default file to serve. If the first file isn't found, 
index index.php index.html index.htm;
# ESSENTIAL : no favicon logs
location = /favicon.ico {
    log_not_found off;
    access_log off;
}
# ESSENTIAL : robots.txt
location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
}
# ESSENTIAL : Configure 404 Pages
error_page 404 /404.html;
# ESSENTIAL : Configure 50x Pages
error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/www;
    }
# SECURITY : Deny all attempts to access hidden files .abcde
location ~ /\. {
    deny all;
}
# PERFORMANCE : Set expires headers for static files and turn off logging.
location ~*
^.+\.(js|css|swf|xml|txt|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$
{
    access_log off; log_not_found off; expires 30d;
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,246285,246285#msg-246285



More information about the nginx mailing list