I tried installing an HTTPS certificate, and after banging my head against the wall for a few hours, I realized that Nginx is NOT picking up the changes I made in my site configuration files contained within /etc/nginx/sites-available/
When I run service nginx restart
it restarts fine. When I run nginx -t
it says my syntax is OK and my config test is successful. However, when I run service nginx reload
I get an error that says reload: Not running
When I look in /var/log/nginx/error.log
I have these errors.
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to 0.0.0.0:80 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to 0.0.0.0:443 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to [::]:80 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to 0.0.0.0:80 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to 0.0.0.0:443 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to [::]:80 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to 0.0.0.0:80 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to 0.0.0.0:443 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to [::]:80 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to 0.0.0.0:80 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to 0.0.0.0:443 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to [::]:80 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to 0.0.0.0:80 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to 0.0.0.0:443 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: bind() to [::]:80 failed (98: Address already in use)
2016/08/29 16:04:40 [emerg] 14744#14744: still could not bind()
After Googling around, I ran across this command netstat -plutn | grep 80
which gives me...
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 14642/nginx: worker
tcp6 0 0 :::80 :::* LISTEN 14642/nginx: worker
I have no idea what this really means, but reading around, it seems Nginx should NOT be running on port 80? Nginx is my webserver, don't I want it running on port 80?
Not sure how to proceed. I want Nginx to pick up the changes I made in my site config files with the service nginx reload
command, and at the same time I'm hesitant to just copy/paste commands I find around the net since I have 10 websites hosted on this server.
Where am I going wrong? I have tried deleting the default
file in my sites-available
folder as some have suggested, but I just don't really understand what the problem is, and how to fix it.
ps
command right now I get this