Hi,
I'm running a centos 7 box with selfcompiled nginx 1.7.3
My systemd unit file:
[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target
After=network-online.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
However, after reboot nginx doesn't start:
Jul 28 10:11:11 localhost nginx[662]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Jul 28 10:11:11 localhost nginx[662]: nginx: [emerg] bind() to
192.168.1.2:80 failed (99: Cannot assign requested address)
Jul 28 10:11:11 localhost nginx[662]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jul 28 10:11:11 localhost systemd[1]: nginx.service: control process exited, code=exited status=1
Jul 28 10:11:11 localhost systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Jul 28 10:11:11 localhost systemd[1]: Unit nginx.service entered failed state.
But I can manualy start it using systemctl start nginx. Seems systemd fires nginx before network is up.