I am posting this here as a reminder that Centos7 has a weird systemD bug with Nginx
SYMPTOMS:
1) Nginx restart fails after a yum update 2) Error: [root@centos7VM user]# systemctl status nginx.service nginx.service - nginx - high performance web server Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: failed (Result: timeout) since Sun 2019-12-01 21:19:26 MST; 1min 21s ago Docs: http://nginx.org/en/docs/ Process: 820 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS) Dec 01 11:16:00 servername nginx[842]: nginx: the configuration file /etc/nginx/nginx.c… ok
FIX:
1) Modify the file /usr/lib/systemd/system/nginx.service 2) File should look like: [Unit] Description=The NGINX HTTP and reverse proxy server After=syslog.target network.target remote-fs.target nss-lookup.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