nginx + tomcat static and dynamic separation

Nginx+Tomcat

Why static and dynamic separation?

Because the processing efficiency of NGINX static pages is much higher than Tomcat processing capacity (processing capacity ratio of about 6: 1 or so); at the same time separate dynamic resource and static resources, server architecture will be more clear.

 

Static and dynamic separation of about process:

The server receives a request from a client, the request is part of static resources, such as html, css, js and image resources and so on, in part, a request dynamic data. Because tomcat processing speed of static resources is relatively slow, so we can consider all static resources open to independent, to deal with static resources such as nginx server faster processing, while the dynamic requests to tomcat process.

 

 

 

 

 

Installation Deployment:

Installation NGINX:

Depending on the circumstances at the installation dependencies

# yum  -y  install gcc gcc-c++ zlib-devel  openssl  openssl-devel pcre-devel

# Tar zxf nginx-1.4.7.tar.gz

# cd nginx-1.4.7

# ./configure  --prefix=/usr/local/nginx

# make && make install

# netstat -anpt | grep :80

Install Tomcat:

Configuration environment variable:

# rpm -ivh jdk-8u20-linux-x64.rpm

# Vi / etc / profile

######java use####

export JAVA_HOME=/usr/java/jdk1.8.0_20

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

# source /etc/profile

# java –version

Tomcat installation package to extract the / usr / local / tomcat under

 

 

 

Start modify nginx configuration file:

# cd /usr/local/nginx/conf

# Force nginx.conf

 

Restart nginx service, and the test:

 

Guess you like

Origin www.cnblogs.com/luyuheng/p/11646261.html