Hi @all, i have a problem with my nginx server. After a reboot the nginx won't start automatically, if i restart it manually it works like charm. Here are the messages: Code: Mai 18 08:21:57 sub.domain.tld systemd[1]: Starting The nginx HTTP and reverse proxy server... Mai 18 08:22:00 sub.domain.tld nginx[1147]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok Mai 18 08:22:01 sub.domain.tld nginx[1147]: nginx: [emerg] bind() to [MY-IPv4-ADDRESS]:443 failed (99: Cannot assign requested address) Mai 18 08:22:01 sub.domain.tld nginx[1147]: nginx: configuration file /etc/nginx/nginx.conf test failed Mai 18 08:22:01 sub.domain.tld systemd[1]: nginx.service: Control process exited, code=exited status=1 Mai 18 08:22:01 sub.domain.tld systemd[1]: nginx.service: Failed with result 'exit-code'. Mai 18 08:22:01 sub.domain.tld systemd[1]: Failed to start The nginx HTTP and reverse proxy server. The sheduler daemon is sending me this messages: Code: sub.domain.tld - 18.05.2022-08:25 - WARNING - httpd is down! Try rescue httpd (try:3)... sub.domain.tld - 18.05.2022-08:25 - WARNING - Invalid init command action start Does anybody have an idea how to solve this? My system is AlmaLinux release 8.6 (Sky Tiger) (migrated from CentOS 8) with the latest updates. - with PHP 7.4.29 Thanks and greetings, piccolo
That looks like the startup scripts start services in wrong order. I do not know AlmaLinux, so can not say how it should be changed. Try making nginx start later, after network related services are already running. But this is strange: Code: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok ... configuration file /etc/nginx/nginx.conf test failed Check what is in that file. If syntax is OK, it may have wrong value for some setting.
Hi Taleman, thanks for your fast reply! I checked the "/usr/lib/systemd/system/nginx.service" file and that seems pretty right for me. Code: [Unit] Description=The nginx HTTP and reverse proxy server After=network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/run/nginx.pid # Nginx will fail to start if /run/nginx.pid already exists but has the wrong # SELinux context. This might happen when running `nginx -t` from the cmdline. # https://bugzilla.redhat.com/show_bug.cgi?id=1268621 ExecStartPre=/usr/bin/rm -f /run/nginx.pid ExecStartPre=/usr/sbin/nginx -t ExecStart=/usr/sbin/nginx ExecReload=/bin/kill -s HUP $MAINPID KillSignal=SIGQUIT TimeoutStopSec=5 KillMode=mixed PrivateTmp=true [Install] WantedBy=multi-user.target I disabled the service via systemctl and reenabled it but that didn't help either. Any other ideas? Thanks!
The Nginx log entries are stating that Nginx couldn't bind to port 443. Please check first if a process is already running on port 443 and then disable or change the port used by this service.
Just a guess, maybe the network interfaces where nginx tries to bind to are not up at the time systems starts it at boot. Regarding rescue system error, there is an issue in the rescue system at the moment if I remember correctly, so you can ignore it and maybe better disable rescue system. In any case, it's a different error than the startup issue.
That with the network interface could be true too. If that should be the case then OP may want to add to the [Unit] section the following Wants line: Code: Description=The nginx HTTP and reverse proxy server After=network.target remote-fs.target nss-lookup.target Wants=network-online.target