Tomcat+nginx Load Balancer Server build ====================================================================== The Tomcat server is a free open source code Web application Server, which belongs to the lightweight Web application server, which is used in small and medium-sized systems and concurrent access users are not many occasions. It is the same as the Aapache or Nginx Web servers. can handle HTML pages. Because Tomcat is far less capable of processing HTML than Aapache or nginx, it is often used as a servlet and JSP container. ----------------------------------------------------------------------Case Environment Server name: Tomcat server operating system: centos 6.5 x86_64 Server ip: 192.168.200.111 required software: 1, Apache-tomcat-7.0.54.tar.gz 2, jdk-7u65-linux-x64.tar.gz================================================== =====================1, test preparation 1) Shut down the firewall, selinux mechanism. [[email protected] xue]# iptables -f[[email protected] xue]# service Iptables stopiptables: Set the chain as policy ACCEPT:filter [OK]iptables: Clear firewall Rules: [OK]iptables: Uninstalling module: [Determine][[email protected] xue]# chkconfig iptables off[[email &NBSP;PROTECTED]&NBSP;XUE]#&NBSP;SETENFORCE&NBSP;02) Install the JDK (Java development kit) before installing Tomcat [[email protected] xue]# tar xf jdk-7u65-linux-x64.tar.gz [[email protected] xue]# mv jdk1.7.0_65/ /usr/local/java[[email protected] xue]# vi /etc/ profile.d/java.shexport java_home=/usr/local/java //Setting the Java root directory export path= $PATH: $ java_home/bin //Add a subdirectory under the Java root directory in the PATH environment variable------------------------------------------[[email protected] xue]# source /etc/profile.d/java.sh [[email protected] xue]# java - versionjava version "1.7.0_45" openjdk runtime environment (rhel-2.4.3.3.el6-x86_64 &NBSP;U45-B15) openjdk 64-bit server vm (Build 24.45-b08, mixed mode) 3) Installation Configuration Tomcat[[email protected] xue]# tar xf apache-tomcat-7.0.54.tar.gz [[email protected] xue]# mv apache-tomcat-7.0.54 /usr/local/tomcat7[[email protected] xue]# /usr/local/tomcat7/bin/startup.sh using catalina_base: /usr/local/ tomcat7using catalina_home: /usr/local/tomcat7using catalina_tmpdir: /usr/ Local/tomcat7/tempusing jre_home: /usr/local/javausing classpath: /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/ Tomcat7/bin/tomcat-juli.jartomcat started.tomcat runs on port 8080 by default. [[email protected] xue]# netstat -anpt |grep 8080tcp 0 0 :::8080 :::* LISTEN 3060/java then we can open the browser test: http://192.168.200.111:8080/If you turn tomcat off. You can execute the following command: [[email protected] xue]# /usr/local/tomcat7/ bin/shutdown.sh =================================================================4), build a Java Web site 4.1 First create a site publishing path [[email protected] ~]# mkdir -pv /web/webapp1mkdir: created directory "/web" mkdir: created directory "/WEB/WEBAPP1" 4.2 build test page under/web/webapp1 index.jsp[[email protected] ~]# Vi /web/webapp1/index.jsp<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%>This article from "The river, Laugh and Laugh" blog, declined reproduced!
Nginx+tomcat Load Balancing