nginx error "conflicting server name" ignored

Nginx

Nginx Problem Overview


server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    #root /usr/share/nginx/www;

root /home/ubuntu/node-login;
    # Make site accessible from 
    server_name ec2-xx-xx-xxx-xxx.us-west-1.compute.amazonaws.com;

location /{
    proxy_pass http://127.0.0.1:8000/;
    proxy_redirect off;
}

}

this results in nignx error [warn] conflicting server name "ec2..." on 0.0.0.0:80 ignored I dont understand, any explanation appreciated. Thanks.

Nginx Solutions


Solution 1 - Nginx

I assume that you're running a Linux, and you're using gEdit to edit your files. In the /etc/nginx/sites-enabled, it may have left a temp file e.g. default~ (watch the ~).

Depending on your editor, the file could be named .save or something like it. Just run $ ls -lah to see which files are unintended to be there and remove them (Thanks @Tisch for this).

Delete this file, and it will solve your problem.

Solution 2 - Nginx

You have another server_name ec2-xx-xx-xxx-xxx.us-west-1.compute.amazonaws.com somewhere in the config.

Solution 3 - Nginx

There should be only one localhost defined, check sites-enabled or nginx.conf.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1447121View Question on Stackoverflow
Solution 1 - NginxOmar Al-IthawiView Answer on Stackoverflow
Solution 2 - NginxVBartView Answer on Stackoverflow
Solution 3 - NginxMarinView Answer on Stackoverflow