Every time I turn on my computer my nginx is not activated:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Qui 2017-07-27 07:11:02 BRT; 59s ago
Process: 1006 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Jul 27 07:11:01 note-gui systemd[1]: Starting A high performance web server and a reverse proxy server...
Jul 27 07:11:02 note-gui nginx[1006]: nginx: [emerg] host not found in upstream "localhost" in /etc/nginx/sites-enabled/default:27
Jul 27 07:11:02 note-gui nginx[1006]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jul 27 07:11:02 note-gui systemd[1]: nginx.service: Control process exited, code=exited status=1
Jul 27 07:11:02 note-gui systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 27 07:11:02 note-gui systemd[1]: nginx.service: Unit entered failed state.
Jul 27 07:11:02 note-gui systemd[1]: nginx.service: Failed with result 'exit-code'.
~
If i do:
sudo systemctl restart nginx
it works fine, but I have to do that every time I start my Ubuntu.
How can I fix this problem so I don't have to restart nginx every time? I use Ubuntu 16.04.
/lib/systemd/system/nginx.service
the parameterRestart=always
– Ziazis Jul 27 '17 at 10:18/etc/systemd/system
otherwise system updates could wipe out your changes. – Lightbulb1 Sep 04 '19 at 20:52Restart=always
solution a go and it works great. I also addedRestartSec=5s
just to slow down the restart loop if the network never starts resolving domains. I'm running it on a raspberry pi that I'm using as a local package repository cache so its not the most important thing. – Lightbulb1 Sep 04 '19 at 21:07