DotNetCore在Linux发布时候,由于不止一个产品组发布网站,不像以前大家都用IIS的80发布网站。那么就存在大家抢80端口的情况,为了让大家不比加上端口为此用Nginx代理URL实现网站地址代理。顺带代理里csp服务的URL解决跨域问题。
首先得到Nginx源码包,然后解压、编译、安装
cd /liswebtmp/lisweb/nginx/
tar -xvf nginxsrc-1.9.9.tar.gz
yum -y install gcc automake autoconf libtool make
yum -y install gcc-c++
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
cd nginxsrc-1.9.9
chmod +x configure
./configure
make && make install
安装好之后修改配置
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://localhost:1444;
}
location /imedicallis/csp {
proxy_pass http://127.0.0.1:57772/imedicallis/csp;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
多个代理这样加入
然后就能用80访问两个代理地址了
这样就借助Nginx完成代理,后面整理一键安装设置脚本
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)