tomcat的默认端口都是4位,因此访问时必须再链接中加端口,利用nginx可以简单解决这个问题。
nginx.conf配置:
server {
listen 80;
server_name xx.com.cn;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8080;
}
}
server {
listen 80;
server_name xx.cn;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8180;
}
}