1. Install jdk
# Chmod u + x jdk-6u4-linux-x64.bin
#./Jdk-6u4-linux-x64.bin
Press 'Q' and enter yes to generate a jdk1.6.0 _ 04 directory under the current directory.
# Mv jdk1.6.0 _ 04/usr/local/
Configure Environment Variables
# Vim/etc/profile
Join
JAVA_HOME =/usr/local/jdk1.6.0 _ 04
Export JAVA_HOME
CLASSPATH =/usr/local/jdk1.6.0 _ 04/lib:/usr/local/jdk1.6.0 _ 04/jre/lib
Export CLASSPATH
PATH = $ PATH: $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin
Export PATH
JRE =/usr/local/jdk1.6.0 _ 04/jre
Export JRE
# Source/etc/profile
View
# Java-vejava
Version "1.6.0 _ 04"
Java (TM) SE Runtime Environment (build 1.6.0 _ 04-b12)
Java HotSpot (TM) 64-Bit Server VM (build 10.0-b19, mixed mode)
Success!
2. install apache-tomcat
# Wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.16/bin/apache-tomcat-6.0.16.tar.gz
# Tar xzvf apache-tomcat-6.0.16.tar.gz
# Mv apache-tomcat-6.0.16/usr/local/
Configure Environment Variables
# Vim/etc/profile
TOMCAT_HOME =/usr/local/apache-tomcat-6.0.16
Export TOMCAT_HOME
# Source/etc/profile
Start
#/Usr/local/apache-tomcat-6.0.16/bin/startup. sh
The default start port is 8080.
3. Configure nginx to parse jsp and PHP files simultaneously
# Cat/usr/local/nginx/conf/vhosts/www.test.com. conf
Upstream tomcat_server {
Server 127.0.0.1: 8080;
}
Server
{
Listen 80;
Server_name www.test.com;
Index index.html index.htm index. php;
Root/data/httpd/channel.metromall.com.cn;
If (! -E $ request_filename ){
Rewrite ^/(. + \. (html | xml | json | htm | php | asp | shtml) $/index. php? $1 last;
}
Location ~ \. (Jsp | jspx | do )? $
{
Proxy_set_header Host $ host;
Proxy_set_header X-Forwarded-For $ remote_addr;
Proxy_pass http: // tomcat_server;
}
Location ~ . * \. Php .*
{
Include php_fcgi.conf;
Include pathinfo. conf;
}
Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf) $
{
Expires 30d;
}
Location ~ . * \. (Js | css )? $
{
Expires 1 h;
}
Access_log/var/log/nginx/access. log;
# Access_log off;
}
Author: yuangangang_love