systemd配置nginx

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.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=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
User=www
Group=www

[Install]
WantedBy=multi-user.target

 

service文件保存到/lib/systemd/system/nginx.service

重载systemd配置文件
systemctl daemon-reload

systemctl status nginx
systemctl start nginx
systemctl stop nginx
systemctl enable nginx

systemctl reload nginx

 

systemd配置nginx

上一篇:Cookie && Session


下一篇:OS介绍