ubuntu装个nginx
安装nginx
sudo apt-get install nginx
在/etc/nginx/conf.d目录下面,建立xxx.conf文件。
server { listen 80; server_name www.baidu.com; location / { proxy_pass http://127.0.0.1:5000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $http_host; proxy_cache_bypass $http_upgrade; } }
有多个站点就建立多个.conf文件,nginx会自动加载的,站点proxy_pass的端口号要不同,在asp.net core里面可以设置端口号。
加好以后重新运行nginx就好了。
sudo nginx -s reload
sudo systemctl start nginx.service
sudo systemctl enable nginx.service