国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Nginx > 正文

結合 Nginx 將 DoNetCore 部署到 阿里云的安裝配置方法

2024-08-30 12:30:00
字體:
來源:轉載
供稿:網友

基礎環境配置

域名和服務器請先自行購買

基于 云服務器ECS 創建一個應用實例,選擇系統鏡像為 Ubuntu 16.04,在本機通過 SSH 進行遠程連接,并進行相關配置
ssh root@http://39.108.48.203/

...sudo apt-get updatesudp apt-get upgradesudo apt-get autoremovesudo apt-get clean

安裝并配置 Nginx

sudo apt-get install nginxsudo service nginx startsudo gedit /etc/nginx/sites-available/default

配置 default 文件,在文件末尾配置如下節點信息

# Virtual Host configuration for example.com## You can move that to a different file under sites-available/ and symlink that# to sites-enabled/ to enable it.#server { listen  80; # 網站文件的目標位置 root /home/hippie/website/wwwroot; # 網站域名 server_name your website name;  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;   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;   proxy_set_header X-Forwarded-Proto $scheme; }}

檢測配置并更新

sudo nginx -tsudo nginx -s reload

安裝 DotNetCore

請參考官網最新安裝說明:.NetCore Download

部署流程

打開 VisualStudio2017 右鍵要發布的項目,點擊 publish,并參考下圖進行相關配置。

Nginx,DoNetCore,部署,阿里云,安裝配置

Nginx,DoNetCore,部署,阿里云,安裝配置

點擊 Save 按鈕并執行發布操作。然后將 publish 文件夾上傳至服務器相應位置,上傳成功后執行
dotnet run app.dll

如果不出意外的,這個時候,你就可以通過 IP 或者 你的網站域名來進行訪問了。

創建守護進程

執行上述操作之后,我們的程序還是不能正在長時間運行,因此我們需要通過守護進程來管理我們的網站

sudo apt-get install supervisorsudo vim /ect/supervisor/conf.d/website.conf

配置 website.conf 文件

[program:website]#要執行的命令command=/usr/bin/dotnet Attention.dll #命令執行的目錄directory=/home/hippie/website #環境變量environment=ASPNETCORE__ENVIRONMENT=Production  #進程執行的用戶身份user=www-data stopsignal=INT#是否自動啟動autostart=true#是否自動重啟autorestart=true#自動重啟間隔startsecs=1 #標準錯誤日志stderr_logfile=/var/log/website.err.log #標準輸出日志stdout_logfile=/var/log/website.out.log

這個時候,我們執行下述命令啟動守護進程

sudo supervisorctl shutdown && sudo supervisord -c /etc/supervisor/supervisord.confsupervisorctl shutdown sudo service supervisor start

好了,這個時候你可以嘗試關閉遠程連接進行網站訪問,如果能正常訪問的話,說明你的配置已經起作用了.

總結

以上所述是小編給大家介紹的結合 Nginx 將 DoNetCore 部署到 阿里云的安裝配置方法,希望對大家有所幫助,如果大家有任何疑問歡迎給我留言,小編會及時回復大家的!


注:相關教程知識閱讀請移步到服務器教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 上虞市| 游戏| 峨山| 古丈县| 城固县| 尉氏县| 尚志市| 丰顺县| 包头市| 天长市| 大渡口区| 宁化县| 灵宝市| 耒阳市| 南澳县| 额尔古纳市| 黑山县| 宝应县| 铜陵市| 和硕县| 阿荣旗| 嘉禾县| 六枝特区| 唐河县| 澄迈县| 九龙城区| 醴陵市| 贞丰县| 合阳县| 张家港市| 翁源县| 黎川县| 屏山县| 台南县| 白玉县| 大连市| 崇义县| 淅川县| 界首市| 崇义县| 和顺县|