ubuntu 源码安装nginx的systemd的启动文件

2020-04-23  本文已影响0人  Odven

1. 二进制安装的nginx

./configure --prefix=/usr/local/nginx/ --user=www-data --group=www-data --with-http_ssl_module

2. nginx的systemd的文件 nginx.service

vim /lib/systemd/system/nginx.service
[Unit] 
Description=A high performance web server and a reverse proxy 
server
After=network.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/local/nginx/sbin/nginx -s stop
TimeoutStopSec=5
KillMode=mixed

[Install]
WantedBy=multi-user.target
上一篇 下一篇

猜你喜欢

热点阅读