搭建Nginx+Tomcat 负载均衡

Nginx:nginx-1.8.0.tar.gz   

Tomcat:apache-tomcat-8.0.0-RC10.tar.gz

 

客户端192.168.52.40

Nginx192.168.52.73

Tomcat1192.168.52.65

Tomcat2192.168.52.67

 

#gzip  on;

    upstream tomcat_server {

         server 192.168.52.65:8080;

         server 192.168.52.67:8080;

 

location / {

            root   html;

            index  index.html index.htm;

            proxy_pass http://tomcat_server;

        }

 

如果出现下面错误则说明upstream放错位置了,应该放在http模块里面但必须在server模块外面:
nginx: [emerg] "upstream" directive is not allowed herein /etc/nginx/nginx.conf

 

tomcat                             spacer.gif

新建一个new目录,写个index.html

 

spacer.gif

更改访问的根目录,在</Host>前插入最后一句


你可能感兴趣的:(Nginx+Tomcat)