CentOS7安裝DotNetCore環境與Nginx環境

安裝 dotnet core環境

1.添加 dotnet 產品源html

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl= https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'

2.安裝 .NET SDKnginx

sudo yum update
sudo yum install libunwind libicu
sudo yum install dotnet-sdk-3.1

3.安裝ASP.NET Core 運行時瀏覽器

sudo yum install aspnetcore-runtime-3.1

4.安裝.NET Core 運行時url

sudo yum install dotnet-runtime-3.1

安裝完畢以後,輸入命令  dotnet --info  若是出現Version版本號,表示安裝.net core 成功,能夠繼續下一步操做。spa

 

 

安裝nginx

1.添加 Nginx 倉庫.net

sudo yum install epel-release

2.安裝 Nginxcode

sudo yum install nginx

3.啓動 Nginxserver

sudo systemctl start nginx

4.防火牆容許HTTP與HTTPS傳輸htm

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

5.Nginx 開機啓動blog

sudo systemctl enable nginx

6.打開nginx.conf配置文件配置端口,默認80 (由於我80端口在其餘地方使用,這裏我配置8000端口,配置完執行nginx -t、nginx -s reload 檢查與重載配置)

server {
         listen       8000 default_server;
         listen       [::]:8000 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

         error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
         location = /50x.html {
        }
    }

7.在瀏覽器中訪問ip+端口 運行

相關文章
相關標籤/搜索