具体步骤如下:
新建nginx.service文件
vim /lib/systemd/system/nginx.service
内容:
[Unit]Description=nginx serviceAfter=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.confExecReload=/usr/local/nginx/sbin/nginx -s reloadExecStop=/usr/local/nginx/sbin/nginx -s quitPrivateTmp=true [Install] WantedBy=multi-user.target
开机自启
systemctl enable nginx.service
相关推荐:nginx教程
以上就是设置nginx开机自启动的方法的知识。速戳>>知识兔学习精品课!