Question

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

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!

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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