• dotnet on centos 7 日常维护


    1.查看进程

     ps -aux |grep dotnet

    2.杀dotnet进程

    命令:kill 进程ID

     kill 21887

    3.修改 dotnet supervisor 配置

      3.1. 修改 /etc/supervisor/supervisord.conf,在最后面加上如下命令(将/etc/supervisor/conf.d/ 下面的配置都包含进去)

    [include]
    files=/etc/supervisor/conf.d/*.conf

      3.2. 在/etc/supervisor/conf.d/ 下面创建dotnet配置,写入下列命令行

    [program:ylhcms.dll]
    command=/bin/bash -c "dotnet ylhcms.dll"
    directory=/usr/local/ylhcms/
    autorestart=true
    stderr_logfile=/var/log/ylhcms.dll.err.log
    stdout_logfile=/var/log/ylhcms.dll.out.log
    environment=ASPNETCORE_ENVIRONMENT=Production
    user=root
    opsignal=INT
    autostart=true
    autorestarti=true
    startsecs=3

    4.启动和查看,重新启动supervisor   守护进程--启动supervisor

    --启动所有的被守护进程(/etc/supervisor/conf.d/下面的进程)
    supervisord -c /etc/supervisor/supervisord.conf


    --查看 运行状态
    supervisorctl status


    --关闭 一个被守护进程

    supervisorctl stop ylhcms.dll


    --开启 一个被守护进程
    supervisorctl start ylhcms.dll

    --查看 supervisor进程ID,获取到 进程ID 12288

      ps -aux | grep supervisord

      --根据进程ID 杀进程 supervisord  

      kill 12288

      

    5.代码部署(独立环境发布)

     发布打包之后,压缩成.zip格式,"rz"  上传,解压缩至 /user/local/ylhcms 下面

    rz 
    
    unzip ylhcms.zip

    6.修改Nginx站点配置信息

    vim /usr/local/nginx/conf/nginx.conf
    server {
      listen 80;
      server_name www.xx.com;
      # root /usr/local/ylhcms/;
      location ~.*(js|css|svg)$ {
          root /usr/local/ylhcms/wwwroot/;#尤其注意这一行,配置静态文件目录
          index /index.html;
      }
    

       location ~.*(rar|zip)$/ {
          root /usr/local/ylhcms/wwwroot/;
          add_header Content-Type "application/octet-stream;charset=utf-8";
          add_header Content-Disposition "attachment; filename*=utf-8'zh_cn'$arg_n";

       }


    #location
    ~ /.well-known/acme-challenge { # allow all; # } location / { proxy_pass http://localhost:5000; # 刚才设置的地址端口 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }

    7.重启 Nginx

     /usr/local/nginx/sbin/nginx -s reload
  • 相关阅读:
    How to print GETDATE() in SQL Server with milliseconds in time?
    StarLink卫星网络如何工作
    Chinasat16
    天线增益计算
    Schemachine
    源代码之整洁代码
    关于进程内缓存与分布式缓存
    IOT物联网时代测试演化
    互联网大促运维实践案例
    Kubernetes应用场景
  • 原文地址:https://www.cnblogs.com/shellphen/p/13523531.html
Copyright © 2020-2023  润新知