Nginx教程

systemd配置nginx

本文主要是介绍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的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!