首页 > 代码库 > nginx+tomcat实现单IP,多域名,多站点的访问
nginx+tomcat实现单IP,多域名,多站点的访问
其实这个问题分为两个子问题来解决:
b.多实例tomcat配置实现单机多站点
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream www.aaa.com {
server 124.205.16.69:8090;
}
upstream www.bbb.com {
server 124.205.16.69:8100;
}
server {
listen 80;
server_name www.aaa.com;
location / {
index index.html index.jsp;
proxy_pass http://www.aaa.com;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100m;
}
}
server {
listen 80;
server_name www.bbb.com;
location / {
index index.html index.jsp;
proxy_pass http://www.bbb.com;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100m;
}
}
}
nginx+tomcat实现单IP,多域名,多站点的访问