Nginx的反向代理和域名绑定

域名有一级域名和二级域名。只要买下一级域名后,二级域名就随便定义了。

比如taotao.com就是一级域名。

www.taotao.com、search.taotao.com、order.taotao.com、sso.taotao.com就都是二级域名了。

在系统发布时,应该把所有的域名和Nginx的服务器IP绑定,访问所有的域名都会相应到Nginx上,再有Nginx来反向代理。

需要配置Nginx的conf文件,处理各个请求。

 upstream manager.taotao.com {
	server 192.168.226.135:8080;
    }
    upstream rest.taotao.com {
	server 192.168.226.142:8080;
    }
    upstream search.taotao.com {
	server 192.168.226.142:8081;
    }
    upstream sso.taotao.com {
	server 192.168.226.142:8082;
    }
     upstream order.taotao.com {
	server 192.168.226.142:8083;
    }
     upstream www.taotao.com {
	server 192.168.226.143:8080;
    }
    server {
	listen   80;
	server_name  manager.taotao.com;
	location / {
		proxy_pass http://manager.taotao.com;
		index  index.html index.htm;
	}
    }

    server {
	listen   80;
	server_name  rest.taotao.com;
	location / {
		proxy_pass http://rest.taotao.com;
		index  index.html index.htm;
	}
    }
    server {
	listen   80;
	server_name  search.taotao.com;
	location / {
		proxy_pass http://search.taotao.com;
		index  index.html index.htm;
	}
    }
    server {
	listen   80;
	server_name  sso.taotao.com;
	location / {
		proxy_pass http://sso.taotao.com;
		index  index.html index.htm;
	}
    }
    server {
	listen   80;
	server_name  order.taotao.com;
	location / {
		proxy_pass http://order.taotao.com;
		index  index.html index.htm;
	}
    }
	server {
	listen   80;
	server_name  www.taotao.com;
	location / {
		proxy_pass http://www.taotao.com;
		index  index.html index.htm;
	}
	}

 

你可能感兴趣的:(涛涛商城)