美文网首页
centos7.6 配置nginx自启动

centos7.6 配置nginx自启动

作者: Daisy小朋友 | 来源:发表于2020-06-22 17:41 被阅读0次

    配置systemctl自启动

    # cd /lib/systemd/system/
    # vim nginx.service
    [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 quit
    PrivateTmp=true 
       
    [Install] 
    WantedBy=multi-user.target
    

    QUIT:从容关闭
    nginx -s reload : 热重启
    退出并保存文件,执行systemctl enable nginx.service使nginx开机启动
    启动方法:
    systemctl start nginx.service 启动nginx
    systemctl stop nginx.service 结束nginx
    systemctl restart nginx.service 重启nginx

    相关文章

      网友评论

          本文标题:centos7.6 配置nginx自启动

          本文链接:https://www.haomeiwen.com/subject/jvkffktx.html