现在公司有两个应用(tomcat),使用同一个域名,在一台服务器机子,因为post过来的数据也需要,所以使用ngixn做代理分发,配置如下:(已简化)
http {
upstream back1 {
server 127.0.0.1:1111;
}
upstream back2 {
server 127.0.0.1:2222;
}
upstream domainback1 {
server 127.0.0.1:8088;
}
upstream domainback2 {
server 127.0.0.1:8089;
}
server
{
listen 80;
server_name www.abc.com;
if (条件) {
proxy_pass http://back1;
}
if (条件) {
proxy_pass http://back2;
}
}
server
{
listen 1111;
server_name www.abc.com;
location /
{
include xxx_rewrite.conf;
}
location ~ (.jsp)|(.do)$
{
include xxx_rewrite.conf;
server
{
listen 2222;
server_name www.abc.com;
location /
{
include xxx_rewrite.conf;
}
location ~ (.jsp)|(.do)$
{
include xxx_rewrite.conf;
proxy_pass //domainback2;
}
}
}