Dynamic and Static separation using nginx + tomcat + httpd

Source: Internet
Author: User

Topology:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/042S42405-0.png "title =" qq201310020.2454.png "alt =" 162615975.png"/>

Node1: nginx 172.16.8.10

Node2: tomcat 172.16.8.8

Node3: httpd 172.16.251.130

Bytes -----------------------------------------------------------------------------------------

Lab environment:

Jdk-7u9-linux-x64.rpm

Apache-tomcat-7.0.42.tar.gz

Mysql-5.5.33.tar.gz

Nginx-1.4.2.tar.gz

JspRun! _6.0.0_GBK.zip

Bytes -----------------------------------------------------------------------------------------

1. Install nginx on node1 and add the following content:

[Root @ yulong ~] # Vim/etc/nginx. conflocation/{} location ~ * \. (Gif | png | jpeg | bmp | jpg | htm) $ {proxy_pass http: // 172.16.251.130: 80 ;}# location of the static file and image server to be proxy ~ * \. (Jsp | do | css) {proxy_pass http: // 172.16.8.8: 80;} # dynamic data server to be proxy

2. install tomcat and mysql Databases on node2

2.1 install JDK [root @ yulong ~] # Rpm-ivh jdk-7u9-linux-x64.rpmPreparing... ######################################## ### [100%] 1: jdk ####################################### #### [100%] 2. 2. set the JDK environment variable [root @ yulong jdk1.7.0 _ 09] # vim/etc/profile. d/java. shexport JAVA_HOME =/usr/java/latestexport PATH = $ JAVA_HOME/bin: $ PATH [root @ yulong jdk1.7.0 _ 09] # source/etc/profile. d/java. sh2.3. view the java version status [root @ yulong bin] # java-versionjava version "1. 7.0_09 "Java (TM) SE Runtime Environment (build 1.7.0 _ 09-b05) Java HotSpot (TM) 64-Bit Server VM (build 23.5-b02, mixed mode) 2. 4. install tomcat [root @ yulong ~] # Tar xf apache-tomcat-7.0.42.tar.gz-C/usr/local/[root @ yulong local] # ln-sv apache-tomcat-7.0.42 tomcat 'tomcat '-> 'apache-tomcat-7.0.42' 2. 5. set the tomcat environment variable [root @ yulong tomcat] # vim/etc/profile. d/tomcat. sh [root @ yulong tomcat] # source/etc/profile. d/tomcat. shexport CATALINA_HOME =/usr/local/tomcatexport PATH = $ CATALINA_HOME/bin: $ PATH2.6. start tomcat [root @ yulong bin] # catalina. sh start2.7. edit the tomcat configuration file and add [Root @ yulong conf] # vim server. xml [root @ yulong conf] # mkdir/web/app-pHost name = "www.yulong.com" appBase = "/web/app" unpackWARs = "true" autoDeploy = "true"> <valve className = "org. apache. catalina. valves. accessLogValve "directory =" logs "prefix =" yulong_access_log. "suffix = ". txt "pattern =" % h % l % u % t & quot; % r & quot; % s % B "/> <Context path ="/"docBase ="/web/app "/> </Host> Connector port =" 80 "protocol =" HTTP/1.1 "does not need to be added. You only need to change 8080 to 802. 8. Unzip the Forum installation package and put it in the tomcat program directory file [root @ yulong ~] # Unzip JspRun \! _6.0.0_GBK.zip [root @ yulong ~] # Cp upload/*/web/app/-r

3. Install http on node3 to provide a static page

[Root @ yulong ~] # Unzip JspRun \! _6.0.0_GBK.zip [root @ yulong ~] # Cp upload/*/var/www/html-r3.1 start the httpd service [root @ yulong ~] # Service httpd start

4. Check whether the page is displayed normally.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/042S44251-1.png "title =" 11.png" alt = "163645759.png"/>



This article is from the "linux" blog, please be sure to keep this source http://gyulong.blog.51cto.com/6844383/1304021

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.