tomcat的server.xml文件下可以配置
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
nginx proxy_pass实现项目upstream负载:
upstream hostname{
server 127.0.0.1:8080max_fails=0 weight=1;
server 127.0.0.1:8090 max_fails=0 weight=1;
server 192.168.5.82:8080 max_fails=0 weight=1;
}
server {
listen80;
server_name_;
#charset koi8-r;
#access_loglogs/host.access.logmain;
location / {
proxy_passhttp://hostname;
proxy_set_header X-Real-IP $remote_addr;
#root/usr/share/nginx/html;
#indexindex.html index.htm;
# example
#ModSecurityEnabled on;
#ModSecurityConfig /etc/nginx/modsecurity.conf;
#rewrite ^/ http://192.168.5.31:8080/XYD;
}
error_page404/404.html;
location = /404.html {
root/usr/share/nginx/html;
}
【nginx配置tomcat与配置rewrite。】----rewrite的解释
#rewrite ^/ http://192.168.5.31:8080/XYD;
配置后 访问 localhost后项目直接跳转到相应的域名项目目录。