CentOS 7.3 上使用 Nginx 搭建 .Net Core 平台

1. 安装Nginx
yum -y install gcc gcc-c++ automake autoconf make net-tools wget
yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
wget http://nginx.org/download/nginx-1.10.3.tar.gz
tar -zxvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure --prefix=/opt/nginx --with-pcre --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module
make && make install

创建快捷方式  
sudo ln -s /opt/nginx/sbin/nginx /usr/local/bin
nginx
nginx -s reload

2. 安装.Net Core运行时
sudo yum install libunwind libicu
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?linkid=843420
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin

配置反向代理
vi /opt/nginx/conf/nginx.conf
proxy_pass http://localhost:5000;

打开端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
systemctl restart firewalld
Posted by 何敏 on 2017/03/26 13:51:25