Page 1 of 2

Nginx fails to restart after enabling SSL Support; Site goes down

Posted: Sat Dec 17, 2016 3:52 pm
by h2p
After Enabling SSL Support and entering required keys, and then hitting Save, the settings get saved but the site goes down and nginx fails to restart.

Nginx error log gives the following:

CODE: SELECT ALL
2016/11/02 18:59:29 [emerg] 8687#8687: bind() to 104.131.90.2:443 failed (98: Address already in use)
2016/11/02 18:59:29 [emerg] 8687#8687: bind() to 104.131.90.2:443 failed (98: Address already in use)
2016/11/02 18:59:29 [emerg] 8687#8687: bind() to 104.131.90.2:443 failed (98: Address already in use)
2016/11/02 18:59:29 [emerg] 8687#8687: still could not bind()
2016/11/02 18:59:54 [emerg] 8922#8922: bind() to 104.131.90.2:443 failed (98: Address already in use)
2016/11/02 18:59:54 [emerg] 8922#8922: bind() to 104.131.90.2:443 failed (98: Address already in use)
2016/11/02 18:59:54 [emerg] 8922#8922: bind() to 104.131.90.2:443 failed (98: Address already in use)
2016/11/02 18:59:54 [emerg] 8922#8922: bind() to 104.131.90.2:443 failed (98: Address already in use)
2016/11/02 18:59:54 [emerg] 8922#8922: bind() to 104.131.90.2:443 failed (98: Address already in use)
2016/11/02 18:59:54 [emerg] 8922#8922: still could not bind()


BUT if I reboot the server, Nginx starts up and I can access the site with both 'http' and with 'https' but I get 500 Internal Server on the page and 502 Bad Gateway in browser console. This error goes away if I disable the SSL support from VestaCP panel and reboot the server.

For your consideration:

nginx version: nginx/1.10.2
vesta - core package Version:0.9.8 (amd64) Release:16

Re: Nginx fails to restart after enabling SSL Support; Site goes down

Posted: Tue Mar 14, 2017 2:38 pm
by skurudo
You can try to look who uses port like this:

Code: Select all

netstat -tulpn | grep :80

Re: Nginx fails to restart after enabling SSL Support; Site goes down

Posted: Thu Mar 16, 2017 8:47 pm
by h2p

Code: Select all

tcp        0      0 x.x.x.x:8080     0.0.0.0:*               LISTEN      -
tcp        0      0 x.x.x.x:8080          0.0.0.0:*               LISTEN      -
tcp        0      0 x.x.x.x:80       0.0.0.0:*               LISTEN      -
tcp        0      0 x.x.x.x:80            0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:8081          0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:8083            0.0.0.0:*               LISTEN      1730/nginx: worker
tcp        0      0 127.0.0.1:8084          0.0.0.0:*               LISTEN     

Re: Nginx fails to restart after enabling SSL Support; Site goes down

Posted: Fri Mar 17, 2017 6:47 am
by skurudo
Sorry, wrong port

Code: Select all

netstat -tulpn | grep :443

Re: Nginx fails to restart after enabling SSL Support; Site goes down

Posted: Sun Mar 19, 2017 7:36 pm
by h2p
tcp 0 0 127.0.0.1:443 0.0.0.0:* LISTEN 1855/apache2
tcp 0 0 10.17.x.x:443 0.0.0.0:* LISTEN 1855/apache2
tcp 0 0 104.131.38.xxx:443 0.0.0.0:* LISTEN 1855/apache2

Re: Nginx fails to restart after enabling SSL Support; Site goes down

Posted: Mon Mar 20, 2017 3:40 pm
by skurudo
Why your apache use 443 port? It's unusual.

Show us output:

Code: Select all

find /etc/apache2/ -type f | xargs grep 443

Re: Nginx fails to restart after enabling SSL Support; Site goes down

Posted: Mon Mar 20, 2017 5:08 pm
by h2p

Code: Select all

/etc/apache2/conf.d/10.17.x.x.conf:Listen 10.17.x.x:8443
/etc/apache2/conf.d/104.131.38.xxx.conf:Listen 104.131.38.xxx:8443
/etc/apache2/ports.conf:Listen 104.131.38.xxx:443
/etc/apache2/ports.conf:Listen 10.17.x.x:443
/etc/apache2/ports.conf:Listen 127.0.0.1:443
/etc/apache2/sites-available/000-default-le-ssl.conf:<VirtualHost *:443>
/etc/apache2/sites-available/default-ssl.conf:  <VirtualHost _default_:443>

Re: Nginx fails to restart after enabling SSL Support; Site goes down

Posted: Mon Mar 20, 2017 5:26 pm
by skurudo

Code: Select all

/etc/apache2/ports.conf:Listen 104.131.38.xxx:443
/etc/apache2/ports.conf:Listen 10.17.x.x:443
/etc/apache2/ports.conf:Listen 127.0.0.1:443
/etc/apache2/sites-available/000-default-le-ssl.conf:<VirtualHost *:443>
/etc/apache2/sites-available/default-ssl.conf:  <VirtualHost _default_:443>
Here is your little monsters ;-)
You can try change those to 8443 and check with restarts.

Re: Nginx fails to restart after enabling SSL Support; Site goes down

Posted: Mon Mar 20, 2017 8:31 pm
by h2p
Error: apache2 restart failed

Re: Nginx fails to restart after enabling SSL Support; Site goes down

Posted: Tue Mar 21, 2017 2:11 pm
by skurudo
Any apache2 errors in logs?