zoukankan      html  css  js  c++  java
  • systemd管理nginx

    首先安装nginx,此处不做赘述。

    保存以下内容到/lib/systemd/system/nginx.service文件。

    [Unit]
    Description=The NGINX HTTP and reverse proxy server
    After=network.target remote-fs.target nss-lookup.target
    
    [Service]
    Type=forking
    PIDFile=/run/nginx.pid
    ExecStartPre=/usr/sbin/nginx -t
    ExecStart=/usr/sbin/nginx
    ExecReload=/usr/sbin/nginx -s reload
    ExecStop=/bin/kill -s QUIT $MAINPID
    PrivateTmp=true
    
    [Install]
    WantedBy=multi-user.target

    注意:将上面内容中的路径改为实际的路径。

    重载systemd配置文件

    systemctl daemon-reload

    启动服务

    systemctl start nginx.service

    开机启动

    systemctl enable nginx.service

    更多命令

    systemctl reload nginx.service 重新加载nginx服务

    systemctl stop nginx.service 停止nginx服务

  • 相关阅读:
    第一阶段各队建议
    解决死锁四大方式
    进程和线程区别
    windows 地址空间分配
    Linux下用户组、文件权限详解
    2016总结
    class内部处理
    c++ devived object model
    static
    reinterpret
  • 原文地址:https://www.cnblogs.com/liyuchuan/p/10970789.html
Copyright © 2011-2022 走看看