Integration of php and java Environments

Source: Internet
Author: User

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

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.