1、添加开机自启文件
[[email protected] ~]# cat /lib/systemd/system/nginx.service
#!/bin/bash
[Unit]
Description=nginx
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 quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
2、设置nginx服务开机自启
[[email protected] ~]# systemctl enable nginx
原文地址:https://www.cnblogs.com/effortsing/p/10060951.html
时间: 2024-10-05 12:00:02