centos7-nginx开机启动

1.首先需要一个service的启动脚本

#vim /lib/systemd/system/nginx.service

[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/

After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/var/nginx/logs/nginx.pid
ExecStartPre=/usr/sbin/nginx  -t -c /etc/nginx/conf/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

systemctl enable nginx

chkconfig –add nginx

本站大部分内容来自网络和网友投稿,如果侵犯了您的权益,请与我们联系,QQ:1101201144:Nginx开发与运维 » centos7-nginx开机启动

赞 (0)

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址