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

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
h2p
Posts: 12
Joined: Sat Dec 17, 2016 3:39 pm

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

Postby h2p » Sat Dec 17, 2016 3:52 pm

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

skurudo
VestaCP Team
Posts: 7669
Joined: Fri Dec 26, 2014 2:23 pm
Location: Moscow
Contact:

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

Postby skurudo » Tue Mar 14, 2017 2:38 pm

You can try to look who uses port like this:

Code: Select all

netstat -tulpn | grep :80
-> DigitalOcean competition - please, support us
-> fix for phpmyadmin - nice and sweet now

h2p
Posts: 12
Joined: Sat Dec 17, 2016 3:39 pm

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

Postby h2p » Thu Mar 16, 2017 8:47 pm

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     

skurudo
VestaCP Team
Posts: 7669
Joined: Fri Dec 26, 2014 2:23 pm
Location: Moscow
Contact:

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

Postby skurudo » Fri Mar 17, 2017 6:47 am

Sorry, wrong port

Code: Select all

netstat -tulpn | grep :443
-> DigitalOcean competition - please, support us
-> fix for phpmyadmin - nice and sweet now

h2p
Posts: 12
Joined: Sat Dec 17, 2016 3:39 pm

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

Postby h2p » Sun Mar 19, 2017 7:36 pm

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

skurudo
VestaCP Team
Posts: 7669
Joined: Fri Dec 26, 2014 2:23 pm
Location: Moscow
Contact:

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

Postby skurudo » Mon Mar 20, 2017 3:40 pm

Why your apache use 443 port? It's unusual.

Show us output:

Code: Select all

find /etc/apache2/ -type f | xargs grep 443
-> DigitalOcean competition - please, support us
-> fix for phpmyadmin - nice and sweet now

h2p
Posts: 12
Joined: Sat Dec 17, 2016 3:39 pm

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

Postby h2p » Mon Mar 20, 2017 5:08 pm

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>

skurudo
VestaCP Team
Posts: 7669
Joined: Fri Dec 26, 2014 2:23 pm
Location: Moscow
Contact:

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

Postby skurudo » Mon Mar 20, 2017 5:26 pm

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.
-> DigitalOcean competition - please, support us
-> fix for phpmyadmin - nice and sweet now

h2p
Posts: 12
Joined: Sat Dec 17, 2016 3:39 pm

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

Postby h2p » Mon Mar 20, 2017 8:31 pm

Error: apache2 restart failed

skurudo
VestaCP Team
Posts: 7669
Joined: Fri Dec 26, 2014 2:23 pm
Location: Moscow
Contact:

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

Postby skurudo » Tue Mar 21, 2017 2:11 pm

Any apache2 errors in logs?
-> DigitalOcean competition - please, support us
-> fix for phpmyadmin - nice and sweet now


Return to “Web Server”



Who is online

Users browsing this forum: No registered users and 5 guests