Nginx configuration server cluster, load balancer

Source: Internet
Author: User

Locate nginx.conf under the Conf file in the Nginx root directory, and edit

Configure the server IP and port number before server{}

Such as:


Upstream Local_tomcat {

Local_tomcat for the access path, configure the server IP and port number below, you can also assign weights (weight==? )
Server 127.0.0.1:8080; #权重
Server 127.0.0.1:8081; #权重
}

server {
Listen 80; #端口
server_name localhost; #ip

#charset Koi8-r;

#access_log Logs/host.access.log Main;

Location/{
root HTML;
Index index.html index.htm;
}

# All static requests are handled by Nginx, and directories are stored in HTML
Location ~ \. (GIF|JPG|JPEG|PNG|BMP|SWF|JS|CSS) $ {
root HTML;
}

# All dynamic requests are forwarded to Tomcat processing
location/store_v2.0 {

---------------Configure the access path here-------------
Proxy_pass Http://local_tomcat;
}
Finally, don't forget to configure <distributable/> in the XML of the project

As well as modify the Tomcat conf file under the Server.xml 134 line of <cluster classname= "Org.apache.catalina.ha.tcp.SimpleTcpCluster"/>

The wrong place everyone, you can leave a message below

Nginx configuration server cluster, load balancer

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.