安装 dotnet core环境
1.添加 dotnet 产品源
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo sh -c 'echo -e "[packages-microsoft-com-prod] name=packages-microsoft-com-prod baseurl= https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod enabled=1 gpgcheck=1 gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'
2.安装 .NET SDK
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 运行时
sudo yum install dotnet-runtime-3.1
安装完毕之后,输入命令 dotnet --info 如果出现Version版本号,表示安装.net core 成功,可以继续下一步操作。
安装nginx
1.添加 Nginx 仓库
sudo yum install epel-release
2.安装 Nginx
sudo yum install nginx
3.启动 Nginx
sudo systemctl start nginx
4.防火墙允许HTTP与HTTPS传输
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload
5.Nginx 开机启动
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+端口 运行