centos7 nginx添加自启

第一步:进入服务文件夹

  cd /usr/lib/systemd/system

第二步:vi nginx.service 添加以下内容

[Unit]
Description=nginx
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx reload
ExecStop=/usr/local/nginx/sbin/nginx quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target

 

第三步:刷新服务配置

  systemctl daemon-reload

第四步:添加自启

  systemctl enable nginx.service

posted @ 2020-09-02 11:09  不解释丨Python  阅读(159)  评论(0编辑  收藏  举报