zoukankan      html  css  js  c++  java
  • CentOS 7下使用systemctl为Nginx启用进程守护实现开机自启

    1、cd到指定目录

    cd /usr/lib/systemd/system

    2、创建nginx.service

    vi nginx.service

    3.输入以下内容,路径为nginx安装路径

    [Unit]
    Description=nginx - high performance web server
    Documentation=http://nginx.org/en/docs/
    After=network.target remote-fs.target nss-lookup.target  
    
    [Service]
    Type=forking
    PIDFile=/usr/local/nginx/logs/nginx.pid
    ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ExecReload=/bin/kill -s HUP $MAINPID
    ExecStop=/bin/kill -s QUIT $MAINPID
    PrivateTmp=true
    
    [Install]
    WantedBy=multi-user.target

    设置开机启动

    systemctl enable nginx

    其它命令

    #重启应用
    systemctl restart nginx
    
    #停止应用
    systemctl stop nginx
    
    #查看应用的日志
    systemctl status nginx
  • 相关阅读:
    类BufferedImage
    Fileltem
    文件上传api——MultipartFile
    热插播 devtools
    生成banner
    maven 配置
    配置java环境变量
    u盘如何恢复存储量
    四则运算
    PM
  • 原文地址:https://www.cnblogs.com/ysmc/p/12107511.html
Copyright © 2011-2022 走看看