centos7下的nginx启动脚本

系统版本:CentOS Linux release 7.2.1511 (Core)

nginx版本:nginx-1.14.0.tar.gz

编译安装位置:/usr/local/nginx

启动脚本:

[root@web1 ~]# cat /lib/systemd/system/nginx.service 
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
启动:

[root@web1 ~]# systemctl start nginx.service

[root@web1 ~]# systemctl enable nginx.service

 

你可能感兴趣的:(centos7下的nginx启动脚本)