127.0.0.1 www.xxx.com
127.0.0.1 api.xxx.com
127.0.0.1 manage.xxx.com
127.0.0.1 image.xxx.com
Configuring Interpretation: After the access domain www.xxx.com equivalent access to 127.0.0.1,
Although the domain name resolved, but now if we want to access, have their own plus port: http://www.xxx.com:8080 .
This is not the elegance. We hope that the direct domain names: http://www.xxx.com . In this case the default port is 80, how can we transfer request to 8080 port it?
Here it is necessary to use a reverse proxy tool: Nginx
upstream xxx-manage{
server 127.0.0.1:9001;
# Server id address: port, may be formed with a plurality of clusters
}
upstream {XXX-Gateway
Server 127.0.0.1:10010;
}
upstream {XXX-Portal
Server 127.0.0.1:9002;
}
server {
listen 80;
server_name manage.xxx.com;
location / {
proxy_pass http://xxx-manage;
proxy_connect_timeout 600;
proxy_read_timeout 5000;
}
}
server {
listen 80;
server_name www.xxx.com;
location / {
proxy_pass http://xxx-portal;
proxy_connect_timeout 600;
proxy_read_timeout 5000;
}
}
server {
listen 80;
server_name api.xxx.com;
location / {
proxy_pass http://xxx-gateway;
proxy_connect_timeout 600;
proxy_read_timeout 5000;
}
}