Nginx does not start on boot


My YunoHost server

Hardware: same ol lenovo core2duo thinkcentre
YunoHost version: currently stable but bug has been there for a while
I have access to my server : SSH

Description of my issue

I have noticed that nginx does not start automatically on boot and has to be started manually. It has to be done from a command line through SSH, because no nginx means no web access to the admin or anything else. Logs seem fine (i can paste them if you’d like) and nginx -t showes no configuration issue. My question is : how to start it using cron ? I know you can add the @reboot string and use the sleep argument to delay it a few minutes, but if i use the admin cron list would it do the trick ? Or is there another way ? Thanks !

Mon serveur YunoHost

Matériel: vieux core2duo thinkcentre
Version de YunoHost: en ce moment mais le problème date
J’ai accès à mon serveur : SSH

Description du problème

J’ai remarqué il y a un moment que nginx ne démarrait pas automatiquement au boot. Il faut le démarrer manuellement via ligne de commande en SSH parce que pas de nginx pas de webadmin… Les logs ont l’air ok mais je peux les poster si ça vous dit et nginx -t me dit que tout va bien… Ma question : peut on démarrer nginx via cron ? Avec @reboot et sleep dans le cronjob pour attendre quelques minutes après le boot au cas où, si j’utilise la list cron de admin ça ferait le boulot ? Ou y’a une autre façon de faire ? Merci !

Can you share the output of systemctl status nginx ?

nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-09-17 15:42:46 CEST; 2h 13min ago
       Docs: man:nginx(8)
    Process: 200616 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 200652 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 200670
      Tasks: 3 (limit: 8858)
     Memory: 30.9M
        CPU: 2.503s
     CGroup: /system.slice/nginx.service
             ├─200670 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ├─200671 nginx: worker process
             └─200672 nginx: worker process

I was thinking the service was somehow disabled, but no. Can you share the service log right after a reboot?

Well… Nginx spits out a f*ckton of different logs, can you specify which one ?

Just systemctl status nginx right after a reboot would already be useful

● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: activating (start-pre) since Sun 2022-09-18 10:07:31 CEST; 1min 3s ago
       Docs: man:nginx(8)
Cntrl PID: 789
      Tasks: 1 (limit: 8858)
     Memory: 13.5M
        CPU: 142ms
     CGroup: /system.slice/nginx.service
             └─789 /usr/sbin/nginx -t -q -g daemon on; master_process on;

Warning: some journal files were not opened due to insufficient permissions.

Zblerg this was supposed to be ran as root, or with sudo … :

sudo systemctl status nginx

We can see however that the service is “activating” from like 1 min ago … which is puzzling because nginx is not supposed to take a super long time just to “activate” itself @_@

Pour info, l’instruction qui semble bloquer c’est ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'

(erf… useless comment, it’s written in the status message xD)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.