Question

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

Posted November 28, 2013 58.8k views
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: http://pastebin.com/cthXjPyY my only file in sites-enabled looks like this: http://pastebin.com/mu3Mi9zq 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.

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.

×
Submit an Answer
20 answers
Is nginx running? What's the output of
sudo netstat -plutn | grep 80
?
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.

I'm ready to give up and start over at this point. I appreciate your help.
Are there any files in /etc/nginx/conf.d/?
whoa, apache2?

`tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 14646/apache2`

Well there we go..
I don't remember ever installing it. I started with a clean Ubuntu 12.04 digital ocean image (not a LAMP one) and only followed the nginx tutorials.


Now when I stop apache and restart nginx & fpm, nothing is coming up any more in the browser and when I run that same netstat grep, nothing comes up.

Where to go from this point?
Uninstall apache and reboot your droplet:
sudo apt-get remove apache2

sudo reboot

If nginx doesn't work, check its error logs and see what it's not starting.
When I issue that command I get:

Package apache2 is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 136 not upgraded.

but if I type
which apache2
I get
/usr/sbin/apache2

After reboot Apache2 and nginx are both running
Hmm. What's the output of
sudo dpkg --get-selections | grep apache
?
apache2-mpm-prefork install
apache2-utils install
apache2.2-bin install
apache2.2-common install
libapache2-mod-php5 install
Okay, so the apache binaries are installed. You don't need any of these packages, so uninstall them and reboot your droplet:
sudo apt-get remove apache2* libapache2*

sudo reboot
Previous 1 2 Next