Welcome! Log In Create A New Profile

Advanced

Listen directive with ip appears to swamp out all other server blocks

December 15, 2015 08:01PM
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.
Subject Author Posted

Listen directive with ip appears to swamp out all other server blocks

kiwiheretic December 15, 2015 08:01PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 300
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready