Skip to content

Instantly share code, notes, and snippets.

@lunaczp
Forked from chuyik/nginx.service
Created December 3, 2020 08:48
Show Gist options
  • Select an option

  • Save lunaczp/fde3fed6ad0d14be9d2c065de34a9718 to your computer and use it in GitHub Desktop.

Select an option

Save lunaczp/fde3fed6ad0d14be9d2c065de34a9718 to your computer and use it in GitHub Desktop.
OpenResty Centos 7 启动脚本配置
# OpenResty 默认安装在 /usr/local/openresty
# 该文件应该放在 /usr/lib/systemd/system/nginx.service
# 放好后请运行:
# - systemctl enable nginx.service
# - systemctl start nginx.service
# 然后之后就可以用 service nginx [start/reload/stop] 等命令了
[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/openresty/nginx/logs/nginx.pid
ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -t
ExecStart=/usr/local/openresty/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment