1.安装net core框架
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'
sudo yum update
sudo yum install libunwind libicu
sudo yum install dotnet-sdk-2.0.2
sudo ln -s ~/dotnet/dotnet /usr/local/bin
2.上传代码运行,并运行
3.安装nginx
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm yum install nginx systemctl start nginx
打开后正常运行
配置反向代理
server { listen 80; proxy_set_header Host $host; proxy_pass_header User-Agent; location / { proxy_pass http://localhost:5000; } }
重启: systemctl restart nginx
如果提示502 Bad Gateway,在服务器执行以下命令:
setsebool -P httpd_can_network_connect 1
页面成功打开