I am having trouble understanding why this happens: If I attach an ip address to the listen directives the server_name directive is ignored and it becomes the default server config for all vhosts even though it has a server_name directive.
Here is the config:
server {
listen ramnode:80 ;
root /usr/share/nginx/files;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name files.kiwiheretic.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
"ramnode" is defined in /etc/hosts as:
168.235.86.70 ramnode
If I remove "ramnode" from the listen directive all works. If its included none of my other domains work (with separate server blocks not shown here). Any ideas why?
Thanks in advance.