1. 程式人生 > >Ubuntu 18.04 LTS 上配置 .net core 2.2 + nginx

Ubuntu 18.04 LTS 上配置 .net core 2.2 + nginx

前提條件

.net core 2.2 sdk     nginx

.net core

dotnet run --urls="http://*:5005"  #指定埠啟動

 

nginx

檔案 /etc/nginx/sites-available/default


upstream JQ1{
    server 127.0.0.1:6001 fail_timeout=60s;# 兩個.net core 站點
    server 127.0.0.1:5001 fail_timeout=60s;#
}
server {
    listen 80 default_server;
    listen [::]:80 default_server;

 

    server_name _;

     location / {
        proxy_pass http://JQ1;
        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;
    }

常用命令

sudo nginx -t #檢查Nginx配置

sudo nginx -s reload #重啟Nginx

 

Supervisor

/etc/supervisor/conf.d/site.conf

[program:site]
command=dotnet bin/Debug/netcoreapp2.2/publish/myWebAppp.dll 
directory=/webs/myWebAppp
environment=ASPNETCORE__ENVIRONMENT=Production
stopsignal=INT
autostart=true
autorestart=true
startsecs=3   
stderr_logfile=/var/log/ossoffical.err.log  
stdout_logfile=/var/log/ossoffical.out.log  

 

https://www.cnblogs.com/jhli/p/10042304.html

 

ubuntu mysql 配置

https://blog.csdn.net/weixx3/article/details/80782479