zoukankan      html  css  js  c++  java
  • Linux nginx 自启动

    1、创建nginx守护进程文件

        ①、vim /etc/systemd/system/nginx.service

        ②、添加配置

    [Unit]
    Description=nginx 
    After=network.target 
       
    [Service] 
    Type=forking 
    ExecStart=/usr/local/nginx/sbin/nginx
    ExecReload=/usr/local/nginx/sbin/nginx reload
    ExecStop=/usr/local/nginx/sbin/nginx quit
    PrivateTmp=true 
       
    [Install] 
    WantedBy=multi-user.target

       ③、设置开机自启

              systemctl enable nginx.service

       ④、查看nginx运行状态

              systemctl status nginx.service

       ⑤、启动服务

             systemctl start nginx.service

       ⑥、停止服务

              systemctl stop nginx.service

        ⑦、重启服务

              system restart nginx.service

     2、netcore 守护进程

        ①、创建进程服务

             vim /etc/systemd/system/serviceName.service 【serviceName:服务名称】

        ②、编写配置

    [Unit]
    Description=GreenUntiy.Fast.WebApi #服务描述,随便填就好
    
    [Service]
    WorkingDirectory=/home/GreenUnity/Fast/  #工作目录,填你应用的绝对路径
    ExecStart=/usr/bin/dotnet /home/GreenUnity/Fast/GreenUnity.Fast.WebAp.dll    #启动:前半截是你dotnet的位置(一般都在这个位置),后半部分是你程序入口的dll,中间用空格隔开
    Restart=always  
    RestartSec=25 #如果服务出现问题会在25秒后重启,数值可自己设置
    SyslogIdentifier=GreenUnity.Fast.WebApi  #设置日志标识,此行可以没有
    User=root   #配置服务用户,越高越好
    Environment=ASPNETCORE_ENVIRONMENT=Production
    [Install]
    WantedBy=multi-user.target

        ③、开启自启

                systemctl enable serviceName.service

        ④、启动服务

               systemctl start serviceName.service

      安装参考文章:https://www.cnblogs.com/jackyzm/p/9600738.html

  • 相关阅读:
    矩阵树定理
    随机乱搞算法
    数学
    BZOJ——3412: [Usaco2009 Dec]Music Notes乐谱
    BZOJ—— 3402: [Usaco2009 Open]Hide and Seek 捉迷藏
    洛谷—— P2884 [USACO07MAR]每月的费用Monthly Expense
    洛谷—— P2417 课程
    洛谷—— P1577 切绳子
    COGS 2598. 美丽的感觉
    10.23 模拟赛
  • 原文地址:https://www.cnblogs.com/study10000/p/12854808.html
Copyright © 2011-2022 走看看