Report this

What is the reason for this report?

Nginx config error: [emerg] 1226#0: duplicate location

Posted on April 19, 2015

I’ve been getting web socket errors in the browser console so I added to my site’s Nginx config file, some code a fellow posted here: http://stackoverflow.com/questions/17014969/meteor-websocket-handshake-error… But Nginx did not approve. The site isn’t responding in the browser and it says “fail” when I try to restart the Nginx service after removing the new code from the config file. There’s this error in /var/log/nginx/error.log:

2015/04/18 21:09:57 [emerg] 1226#0: duplicate location "/" in /etc/nginx/conf.d/loyr.conf:14

And this is the Nginx config file for the domain /etc/nginx/conf.d/loyr.conf:

server {
 listen 80;

 server_name loyr.co;

 location / {
 proxy_pass http://localhost:3001;
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection ‘upgrade’;
 proxy_set_header Host $host;
 proxy_cache_bypass $http_upgrade;
 }

}

Any ideas? Thanks!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This question was answered by @jesin:

Hi @temiamosu,

Sorry I’m late but if you’re still having this issue try the following.

The sites-enabled Nginx directory could be having some duplicate files due to improperly closed file editors.

Find such files and remove them.

ls -al /etc/nginx/sites-enabled

As for the PHP errors I think you’re missing a module.

View the original comment

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.