Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams
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.

There seems to be an implicit default 0.0.0.0:80, adding it explicitly worked for me. listen ec2-xx-xx-xxx-xxx.us-west-1.compute.amazonaws.com:80; followed by the server_name directive worked. – user1447121 Jul 11, 2012 at 17:24 Check /etc/nginx/sites-available/<site-name> that is linked to /etc/nginx/sites-enabled/<site-name>. Additional files here may contain duplicate or conflicting configuration. – Hanxue Dec 23, 2015 at 10:36 changing config.force_ssl = true to false solved my problem, this took me days to figure out – Ibukun Muyide Jul 6, 2018 at 2:02 For me this same error was from a missing semi-colon at the end of one of the server_name lines when I had several server entries. – Kevin May 24, 2019 at 12:04 Certbot from LetsEncrypt had added a server block in the default file in my case. It did that cause I tried to get the certificate before I had setup the separate server block. – Alex D Oct 25, 2019 at 17:46

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.

can you clarify? I don't see any "default~" files at all in my /etc/nginx/sites-enabled only the "default" folder. – David Saintloth Jan 10, 2014 at 5:27 In my case some configuration of emacs created a file with a leading and trailing #, e.g. #portal#. – taffit Feb 2, 2017 at 8:04 Nice you can do ls -la /etc/nginx/sites-enabled/end then rm /etc/nginx/sites-enabled/default be careful dont delete – Marco Feregrino Jul 11, 2018 at 1:22 I checked for that and didn't find any. it does not give this warning when i remove the "ec2_xxx ...". Is there an implicit default for 0.0.0.0:80 in nginx config ? – user1447121 Jul 11, 2012 at 17:06 @VBart your link gave me a hint, actually my browser was prefixing https instead of http in my url, thanks – Nikhil Bhardwaj Jan 6, 2022 at 8:23 This solved my issue as well. I had placed 2 same server blocks in different *.conf files. Thanks! – Pranav Jituri May 11, 2017 at 10:25 Also, check all files in this directory: /etc/nginx/conf.d. Each domain can appear only once (as a servername value) amongst files in that directory, as well. That was my issue! – SherylHohman Nov 13, 2018 at 22:24