Received the following error when trying to start nginx on boot in Raspbian GNU/Linux 8 (jessie) nginx.service - A high performance web server and a reverse proxy server   Loaded: loaded (/lib/systemd/system/nginx.service; enabled)   Active: failed (Result: exit-code) since Sun 2016-08-07 10:38:50 EDT; 1min 10s ago  Process: 478 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)My config works fine, and I'm able to start nginx after logging in; but I can't get systemd to start it.Here is my Unit file:# Stop dance for nginx# =======================## ExecStop sends SIGSTOP (graceful stop) to the nginx process.# If, after 5s (--retry QUIT/5) nginx is still running, systemd takes control# and sends SIGTERM (fast shutdown) to the main process.# After another 5s (TimeoutStopSec=5), and if nginx is alive, systemd sends# SIGKILL to all the remaining processes in the process group (KillMode=mixed).## nginx signals reference doc:# http://nginx.org/en/docs/control.html#[Unit]Description=A high performance web server and a reverse proxy serverAfter=syslog.target network.target remote-fs.target nss-lookup.target[Service]Type=forkingPIDFile=/run/nginx.pidExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reloadExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pidTimeoutStopSec=5KillMode=mixed[Install]WantedBy=multi-user.target/lib/systemd/system/nginx.serviceWhat target do I need to start this after?  I've already tried network-online.target (which would make the most sense, and received the same result.UpdateI changed a few things thanks to this post and I got nginx to start up...but it still fails with an error.Modified /etc/systemd/system/mult-user.target.wants/nginx.service to include:After=network-online.targetWants=network-online.targetBefore it was After=network.targetRan sudo systemctl enable systemd-networkd-wait-online.service, to start that up (since network-online.target can't be enabled up using sudo systemctl enable network-online.target)Ran sudo systemctl enable nginxRestarted...After the restart, I ran systemd-analyze plot > something.svg and search for nginx.service within the file, and it was present, however it did not successfully start up instead giving me an error about my reverse proxy server..which I'm not sure how to solve, but that's a topic for another question.Below is the image I got from systemd-analyze plot:However...after I boot the machine, and run sudo systemctl start nginx it starts without issue.Here is the error message from the error log:2017/05/16 13:12:53 [emerg] 555#0: host not found in upstream somehost.somedomain.lan in /etc/nginx/sites-enabled/siteconf:41Here is config line in question:server {     listen     80; ## listen for ipv4; this line is default and implied    #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6    # Make site accessible from http://localhost/    server_name somehost somehost.somedomain.lan;    # Note: There should never be more than one root in a     #       virtual host    #   Also there should never be a root in the location.    #root /var/www/nginx/;         location ^~ / {            resolver 127.0.0.1 valid=300s; # NOTE: Added this to resolve it.            access_log ./logs/RootWiki_access.log;            error_log ./logs/RootWiki_error.log;            proxy_buffers 16 4k;            proxy_buffer_size 2k;            proxy_set_header Host $host;            proxy_set_header X-Real_IP $remote_addr;            rewrite /(.*) /$1 break;            proxy_pass http://wiki.leerdomain.lan:8080; # NOTE: This one causes the error according to the error log.        }
Starting nginx on boot with systemd, Raspbian 8 (jessie)?
systemd;raspbian;nginx;network online.service