Nginx config for enabled sites does not appear to be taking effect any more

  • Posted November 28, 2013

I’m trying to get my server setup to handle multiple wordpress sites on nginx.

I followed the different tutorials in the initial server setup, lemp installation etc.

Everything was working ok with the exception of permalinks not working at all. I couldn’t navigate to any page on the front end (away from the domain root).

So since then I have tried a lot of different things messing with nginx.conf and other files (from instructions in the wp codex), but none of that helped, so since then I’ve tried to go back to a clean slate with nginx and php-fpm.

I uninstalled them both, purged, autocleaned, and reinstalled them.

After this, I’ve gone through the basics again and nginx is running, but something is still very wrong. When I go to my server IP, I get the “It works!” index.html from /var/www/ but my configuration should be pointing it to a different document root.

my nginx.conf looks like this:

my only file in sites-enabled looks like this:

From what I understand, it should be picking up my site’s configuration in sites-enabled rather than loading this file.

I’m stumped, please help.


Submit an 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.

I know I am late to the party, but for those who find this through google: Try launching the url from a different browser before making those changes listed above ;)

Explanation: If you set a bogus redirect rule in a file with a permanent switch, most browsers will remember this rule and cache it. For example chrome caches it in some internal file that can not be cleared by removing cookies and site data - you have to actually clear full browser history and all browsing data for the last x hours.

I hope this doesn’t bump this old thread but THANK YOU. I’ve done this quite a few times and could not figure out why it wasn’t working. I thought my version of Nginx had gone mad. Nope, I just forgot how to symlink…

Sweet! Glad to hear it’s working now :]

Well… I’ve already made some good progress with a clean re-image. <br> <br>I think my problem came down to the symlink I was making between the sites-available config file to the sites-enabled folder.
<br> <br>On the old install, my site’s config file in the sites-enabled folder was glowing in the terminal. I thought it was because it was a symlink, but now I think it was indicative of pointing to a location that didn’t exist. <br>I didn’t really notice anything was different because I had followed one of the tutorials which had instructed me to remove the default config file from the sites-enabled directory. <br> <br>This is how I was creating the link: <br>/etc/nginx$ sudo cp sites-available/default sites-available/one <br>/etc/nginx$ sudo ln -s sites-available/one sites-enabled/one <br> <br>to which I investigated to find: <br> <br>/etc/nginx$ ls -l sites-enabled/ <br>total 0 <br>lrwxrwxrwx 1 root root 34 Dec 8 05:10 default -> /etc/nginx/sites-available/default <br>lrwxrwxrwx 1 root root 19 Dec 8 05:20 one -> sites-available/one <br> <br>Oops! So that explains why my config files were not being loaded. <br> <br>After creating that link properly, it seems to be working now! <br> <br>What can I say other than I guess that was a hard lesson learned, but at least I figured it out! <br> <br>Thanks for your help again!

I forgot to check if it was already running before starting, but started it with no errors - although I think it was already running. The tail command produces no output. <br> <br>I’m ready to give up and start over at this point. I appreciate your help.

That means nginx is not running. Try starting it: <br><pre>sudo service nginx start</pre> <br>If that does not work, try seeing what the error is: <br><pre>sudo tail /var/log/nginx/error.log</pre>

My droplet’s ip is <br> <br>That command gives no output.
<br> <br>According to what I can see in the nginx conf files it should be listening on 80. <br> <br>What else to check?

Hmm. What’s your droplet’s IP address? Also, which port is nginx listening on? <pre>sudo netstat -plutn | grep nginx</pre>

Warning: bad ps syntax, perhaps a bogus ‘-’? See <br>root 1541 0.0 0.1 10252 884 ? Ss 02:40 0:00 nginx: master process /usr/sbin/nginx <br>www-data 1542 0.0 0.2 10392 1288 ? S 02:40 0:04 nginx: worker process <br>www-data 1543 0.0 0.2 10392 1288 ? S 02:40 0:04 nginx: worker process <br>www-data 1544 0.0 0.2 10392 1288 ? S 02:40 0:04 nginx: worker process <br>www-data 1545 0.0 0.2 10392 1288 ? S 02:40 0:00 nginx: worker process <br>1000 2122 0.0 0.1 4368 812 pts/0 S+ 15:48 0:00 grep --color=auto nginx <br>

Are you sure tha tnginx is running? What’s the output of <pre>sudo ps -wwaux | grep nginx</pre>?