[Tomcat] Tomcat+nginx Load balancer Configuration

Source: Internet
Author: User

First download, install Tomcat.

Modify the Tomcat port and modify the Server.xml:

1. Modify the Tomcat port (default 8080)

<port= "8383"  protocol= "http/1.1"               connectiontimeout  = "20000"               redirectport= "8443"/>

2.shutdown Port (default 8005)

<port= "8006"  shutdown= "shutdown">  < className = "Org.apache.catalina.startup.VersionLoggerListener"/>   

3. Modify the AJP port (default 8009)

<!---    <   port = "8019" protocol = "ajp/1.3" Redirectport = "8443" />

At the same time modify the boot two Tomcat, the port is 8383,8484 respectively.

Install Nginx, modify the nginx.conf file, configure Tomcat.

# Tomcat cluster configuration upstream tomcat_cluser{      server 127.0.0.1:8383 weight=1;      Server 127.0.0.1:8484 weight=1;  }
server {        listen       ;        server_name  127.0.0.1;        #charset Koi8-r;        #access_log  logs/host.access.log  main;        Location/{            Proxy_pass http://tomcat_cluser;            root   html;            Index  index.html index.htm;        }        Location ~ \.jsp$ {          proxy_pass http://tomcat_cluser;           }           Location/schedule {               proxy_pass http://tomcat_cluser;        }                Location ~. *\. (gif|jpg|jpeg|png|bmp|swf|apk|tar.gz) $        {          expires      30d;        }    Location ~. *\. (JS|CSS)? $    {          expires      12h;    }}

Start Tomcat and start Nginx.

Visit: localhost, you can see.

[Tomcat] Tomcat+nginx Load balancer Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.