Linux under Nginx+tomcat load Balancing

Source: Internet
Author: User
Tags tomcat server

1. Why do I need to load-balance the Tomcat server configuration? "Go"

The Tomcat server acts as a Web server with a concurrent number of 300-500, and if it is larger than this number, Tomcat will not respond to certain requests and severely affect the program's normal operation. In addition, the number of threads in Tomcat continues to increase in the case of large traffic. Because of the internal control of Tomcat itself, when the memory occupies the maximum value of memory overflow, access to the program will be a serious time-out, such as the need to restart the server to release the occupied memory, the site or game, will cause a great loss. So it is necessary to load-balance tomcat. There are Apache that can be load balanced with Tomcat, but many programmers choose this configuration because Ngnix is more versatile and simple to configure. Ngnix concurrency can be up to 5W, so in theory can be configured with tomcat1:100.

2. Installing Nginx

[[email protected] nginx-1.3.15]# TAR-ZXVF nginx-1.3.15.tar.gz[[email protected] nginx-1.3.15]# CD Nginx-1.3.15[[email Protected] nginx-1.3.15]#./configure--prefix=/usr/local/nginx

Error:

./configure:error:the HTTP Rewrite module requires the PCRE library.

You can either disable the module by using--without-http_rewrite_module

option, or install the PCRE library into the system, or build the PCRE library

Statically from the source with Nginx by using--with-pcre=<path> option.

You need to install the dependent package Pcre:

[email protected] nginx-1.3.15]# yum install-y pcre-devel[[email protected] nginx-1.3.15]#./configure--prefix=/usr/ Local/nginx

Also error:

./configure:error:the HTTP gzip module requires the Zlib library.

You can either disable the module by using--without-http_gzip_module

option, or install the Zlib library into the system, or build the Zlib library

Statically from the source with Nginx by using--with-zlib=<path> option.

To continue installing the dependent package zlib:

[[Email protected] local]# CD Zlib-1.2.8[[email protected] zlib-1.2.8]#./configure[[email protected] sbin]#./configure --prefix=/usr/local/nginx--with-zlib=/usr/local/zlib-1.2.8[[email protected] sbin]# make && make install[[ Email protected] sbin]# pwd/usr/local/nginx/sbin[[email protected] sbin]# Lsnginx[[email protected] sbin]#./nginx

To see if Port 80 is occupied:

[Email protected] sbin]# Netstat-ano|grep 80

Browser access to this ip:http://192.168.26.136/, appears as follows, then build Nginx success.

Welcome to nginx!


This article is from "Facing the sea, really busy" blog, please be sure to keep this source http://yuanyujiao.blog.51cto.com/2095122/1627586

Linux under Nginx+tomcat load Balancing

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.