0

I'm trying to track down a problem with nginx.

service nginx start
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

Then looking at the log:

root@admin:~# systemctl status nginx.service
● nginx.service - LSB: Stop/start nginx
   Loaded: loaded (/etc/init.d/nginx; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-12-24 08:06:17 GMT; 18s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3166 ExecStart=/etc/init.d/nginx start (code=exited, status=1/FAILURE)

Dec 24 08:06:17 admin.xxx.com systemd[1]: Starting LSB: Stop/start nginx...
Dec 24 08:06:17 admin.xxx.com systemd[1]: nginx.service: Control process exited, code=exited status=1
Dec 24 08:06:17 admin.xxx.com systemd[1]: Failed to start LSB: Stop/start nginx.
Dec 24 08:06:17 admin.xxx.com systemd[1]: nginx.service: Unit entered failed state.
Dec 24 08:06:17 admin.xxx.com systemd[1]: nginx.service: Failed with result 'exit-code'.

When looking to see if the port is busy, I see:

sudo netstat -anp | grep ':80 '
tcp        0      0 139.162.248.70:80       0.0.0.0:*               LISTEN      1062/nginx.conf
tcp6       0      0 :::80                   :::*                    LISTEN      1062/nginx.conf

The stupid thing is that nxinx DOES seem to be running! The server uses nginx as a front end (and then Apache2 as the reverse proxy for Perl scripts). So if I go to a site on the server it loads fine: https://bodywisegym.co.uk/

I can't figure it out :/

  • 1
    Looking at the output, you are using a mix of sysv init scripts (/etc/init.d/nginx) and systemd. Look at /run/ to see if you have nginx.pid or /run/nginx/nginx.pid and see if the contents match that of the running process number. If not, just shutdown the nginx process either by killing the master process or issuing nginx -s quit followed by systemctl start nginx – Miuku Dec 24 '19 at 8:55
  • @Miuku thanks. /run/nginx.pid exists (and has a value). 1062. ps aux | grep nginx shows me root 1062 0.0 0.2, so it seems to be correct on that front – Andrew Newby Dec 24 '19 at 9:13
  • 2
    If I were you, I would just kill the nginx process either by /etc/init.d/nginx stop and systemctl start nginx or just kill <PID> where PID is the master process of nginx (owned by root). Also migrating so that you only have systemd .service files rather than a mix of SysV and SystemD would be a good idea IMO. – Miuku Dec 24 '19 at 9:48
  • @Miuku thanks - I actually tried killing it before, but on reboot it had the same issue. Weirdly though - now I just did a reboot and its fine!!! ` Active: active (running) since Tue 2019-12-24 09:58:01 GMT; 3min 28s ago`. I've used the same startup / service stuff since setting up the server, and its never had issues. I'll keep an eye on it. Thanks :) – Andrew Newby Dec 24 '19 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.