编辑文件:
vim /etc/systemd/system/nginx.service
文件内容:
[Unit]
Description=Nginx - high performance web server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
添加到开机启动:
systemctl enable nginx.service
使用systemctl
控制Nginx:
# 启动
systemctl start nginx.service
# 重启
systemctl reload nginx.service
# 停止
systemctl stop nginx.service
打开文件:
vim /etc/profile
末尾添加两行:
PATH=$PATH:/usr/local/nginx/sbin:
export PATH
使配置生效:
source /etc/profile
暂无评论,赶紧发表一下你的看法吧。