Skip to main content

NGINX is down & Fails to restart - more than 10000 tries failed

Comments

14 comments

  • cPRex Jurassic Moderator
    Hey there! Was Nginx installed through WHM on the system? Normally it would be using alternate ports and then sending the traffic to Apache, so it might be best to open a ticket with our team so we can check that configuration on our end.
    0
  • HostNoc
    Hello @Rohit_V Seems nginx process is already running on server which is why its not restarting. Try these commands and see if it starts. killall -9 nginx service nginx restart Regards,
    0
  • ankeshanand
    Since couple of days, I'm flooded with notification that NGinx is down and the System tried more than 10,000 times but failed to check or restart it. I checked with my VPS Hosting company and they said they cant help resolve this. So, trying here, before uninstalling Nginx Manager. Notification:
    Service Name nginx
    Service Status failed
    Notification The service "nginx" appears to be down.
    Service Check Method The system"s command to check or to restart this service failed.
    Number of Restart Attempts 10,503
    Service Check Raw Output (XID *****) The "nginx" service is down. The subprocess "/usr/local/cpanel/scripts/restartsrv_nginx" reported error number 255 when it ended.
    Startup Log Jul 28 17:27:36 myserver,com nginx[3323]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) Jul 28 17:27:37 myserver,com nginx[3323]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Jul 28 17:27:37 myserver,com nginx[3323]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) Jul 28 17:27:37 myserver,com nginx[3323]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Jul 28 17:27:37 myserver,com nginx[3323]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) Jul 28 17:27:38 myserver,com nginx[3323]: nginx: [emerg] still could not bind() Jul 28 17:27:38 myserver,com systemd[1]: nginx.service: control process exited, code=exited status=1 Jul 28 17:27:38 myserver,com systemd[1]: Failed to start nginx - high performance web server. Jul 28 17:27:38 myserver,com systemd[1]: Unit nginx.service entered failed state. Jul 28 17:27:38 myserver,com systemd[1]: nginx.service failed.

    Seems like Port 80 and 443 are already occupied by some other process and because of that NGINX is not able to BIND to that port. Try the Following: lsof :i:80 lsof -i:443
    You will get the PID and Name of the Process occupying the Port. Try to Gracefully shut down and disable the process using systemctl and if its corrupted or in loop, Kill the process using PID and Then Start NGINX, It would work.
    0
  • Rohit_V
    @cPRex I have created ticket @ankeshanand, @HostNoc On checking, recent Tickets with my Hosting provider, it is seen that they changed the port of Apache from 81, 444 to 80, 443 (this was done in mid-Jun) They did this because all my Sites on VPS went down suddenly.
    0
  • cPRex Jurassic Moderator
    Could you post the ticket number here so I can follow along and make sure this thread stays updated?
    0
  • ankeshanand
    @cPRex I have created ticket @ankeshanand, @HostNoc On checking, recent Tickets with my Hosting provider, it is seen that they changed the port of Apache from 81, 444 to 80, 443 (this was done in mid-Jun) They did this because all my Sites on VPS went down suddenly.

    Which provider is it? Its actually wrong is some provider access your VPS and Its Internal Files without Customer's permission.
    0
  • Rohit_V
    @cPRex Christopher from Cpanel team, helped change back the ports. The continuous notifications of Nginx failure have stopped since. @ankeshanand I'm not sure if mentioning provider is ok here?(forum rules/promotion/negative PR for provider ..etc?) As I mentioned, they did it to resolve issue of Sites gone down suddenly. (they acted on ticket raised) The wrong thing on their part was lack of understanding of what ports Apache & Nginx should run on if both are set to run. Christopher from CP team, further suggested the initial issue of Sites gone down can be due to FPM Child process limit hit. so will be monitoring that. Thanks all for your time & responses.
    0
  • cPRex Jurassic Moderator
    I'm glad you were able to get to a good resolution!
    0
  • AlphaPrime
    sudo systemctl restart nginx works for me. But not if i try to add settings in the config file...
    0
  • ankeshanand
    sudo systemctl restart nginx works for me. But not if i try to add settings in the config file...

    Why Using Sudo? Aren't you the root user!
    0
  • AlphaPrime
    Why Using Sudo? Aren't you the root user!

    I am, but only like this works! Any other way fails...
    0
  • cPRex Jurassic Moderator
    @AlphaPrime - I'm not sure exactly what issue you're seeing with the config file. Can you be more specific about the issues you're experiencing?
    0
  • AlphaPrime
    systemctl restart nginx Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. After I add in /etc/nginx/nginx.conf # Load ModSecurity dynamic module load_module /etc/nginx/modules/ngx_http_modsecurity_module.so; The path to the module is a shortcut for /usr/lib64/nginx/modules/ngx_http_modsecurity_module.so - with this path dosen't work either
    0
  • cPRex Jurassic Moderator
    Thanks for the additional details. Our installation instructions don't mention that the configuration needs to be modified. Can you try the details outlined here to see if that works?
    0

Please sign in to leave a comment.