[root@node142 ~]# more /lib/systemd/system/nginx.service
[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=process
PrivateTmp=true
[Install]
WantedBy=multi-user.target
# systemctl start nginx.service
# systemctl status nginx.service
● nginx.service - The NGINX HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2018-03-29 16:37:47 CST; 6s ago
Process: 10588 ExecStart=/u01/app/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 10586 ExecStartPre=/u01/app/nginx/sbin/nginx -t (code=exited, status=0/SUCCESS)
Main PID: 10590 (nginx)
CGroup: /system.slice/nginx.service
├─10590 nginx: master process /u01/app/nginx/sbin/nginx
├─10591 nginx: worker process # Author : Leshami
├─10592 nginx: worker process # Blog : https://blog.csdn.net/leshami
├─10593 nginx: worker process
├─10594 nginx: worker process
├─10595 nginx: worker process
├─10596 nginx: worker process
├─10597 nginx: worker process
├─10598 nginx: worker process
├─10599 nginx: cache manager process
└─10600 nginx: cache loader process
Mar 29 16:37:47 ydq-std systemd[1]: Starting The NGINX HTTP and reverse proxy server...
Mar 29 16:37:47 ydq-std nginx[10586]: nginx: the configuration file /u01/app/nginx/nginx.conf syntax is ok
Mar 29 16:37:47 ydq-std nginx[10586]: nginx: configuration file /u01/app/nginx/nginx.conf test is successful
Mar 29 16:37:47 ydq-std systemd[1]: Started The NGINX HTTP and reverse proxy server.