Hi,
I installed nginx on an ubuntu server and then followed this tutorial
(which
I’ll quote from) to setup server blocks
.(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: