【netcore基礎】CentOS 7.6.1810 搭建.net core 2.1 linux 運行環境 nginx反向代理 supervisor配置自啓動

以前寫過一篇Ubuntu的環境搭建博客,感受一些配置大同小異,這裏重點記錄下 nginx 做爲靜態 angular 項目文件服務器的配置html

參考連接linux

【netcore基礎】ubuntu 16.04 搭建.net core 2.1 linux 運行環境 nginx反向代理 supervisor配置自啓動

 

Nginx配置nginx

 

muc api接口服務的配置,域名(api.wxsale.gedu.org)轉發到5000端口web

以下:ubuntu

    server {
         listen 80;
         server_name api.wxsale.gedu.org;
         root /app/web_root/api.wxsale.gedu.org;
         index index.html  index.htm;
         try_files $uri $uri/ /index.html;
         location / {
             proxy_pass http://127.0.0.1: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;
         }
        error_page 404    /;
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
}
        access_log /applog/nginxlog/api.wxsale.gedu.org_access.log main; error_log /applog/nginxlog/api.wxsale.gedu.org_error.log;

}

重點是配置域名,端口80指向5000,log日誌文件路徑api

 

而後是 angular 項目,靜態文件轉發配置服務器

以下:app

    server {
         listen 80;
         server_name wxsale.gedu.org;
         location / {
             root /app/web_root/wxsale.gedu.org;
             index index.html  index.htm;
             try_files $uri $uri/ /index.html;
         }
        error_page 404    /;
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
}
        access_log /applog/nginxlog/wxsale.gedu.org_access.log main;
        error_log /applog/nginxlog/wxsale.gedu.org_error.log;

}

 

配置差很少。post

 

 superior配置url

[program:GeduFileServer]
command=dotnet GeduFileServer.dll --server.urls http://localhost:5100
directory=/app/web_root/file.wxsale.gedu.org
environment=ASPNETCORE__ENVIRONMENT=Production
user=root
stopsignal=INT
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/app/web_root/file.wxsale.gedu.org/logfile/GeduDistributionApi.err.log
stdout_logfile=/app/web_root/file.wxsale.gedu.org/logfile/GeduDistributionApi.out.log

 

這裏能夠指定服務端口號,就能夠部署多個不一樣端口的項目了

相關文章
相關標籤/搜索