I got a problem which I have been trying to fix for a few days now and I don\'t know what to do, have been looking for answers but all of those I found didn\'t help me.
May come in handy to check syntax of Nginx's configuration files by running:
nginx -t -c /etc/nginx/nginx.conf
I had the same problem when I used Vesta, which uses nginx with apache. The problem was that after applying all updates Apache started listening to 443 for https. The solution was just to comment out the 443 stuff in ports.conf. This is because nginx also uses this port.
Had this issue when provisioning a new site for VVV in vvv-config.yml with a faulty syntax, vagrant up
would throw the error. Deleting and reverting to old configuration, running vagrant provision
helped
When something cannot bind to a port, it's 5% because it's not started by root (sticky suid bit, sudo) and 94% because another application is already bound to that port.
Make sure nginx is really shutdown and you don't try to start it twice by accident.
Make sure you don't have Apache or other services running that use port 80.
Utilize netstat -a | grep tcp
to find out more.
This worked for me:
First, go to
and make the changes in nginx.conf and make the default port to listen from 80 to any of your choice 85 or something.
Then use this command to bind that port type for nginx to use it:
where PORT_TYPE is one of the following: http_cache_port_t, http_port_t, jboss_management_port_t, jboss_messaging_port_t, ntop_port_t, puppet_port_t.
Then run:
[you should see active status]; #sudo systemctl enable nginx
Try to debug with command:
$ service nginx configtest
Which outputs something like:
Testing nginx configuration: nginx: [emerg] unknown directive "stub_status" in /etc/nginx/sites-enabled/nginx_status:11 nginx: configuration file /etc/nginx/nginx.conf test failed
And fix those warnings
Then restart nginx