Home > Backend Development > PHP Tutorial > Integration of php and java environments_PHP tutorial

Integration of php and java environments_PHP tutorial

WBOY
Release: 2016-07-13 17:52:32
Original
1105 people have browsed it

1. Install jdk
#chmod u+x jdk-6u4-linux-x64.bin
#./jdk-6u4-linux-x64.bin
Press the ‘q’ key and enter yes to generate a jdk1.6.0_04 directory in 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)
means 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 startup port is 8080
3. Configure nginx to parse jsp and php files at the same time
#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 1h;
}
Access_log /var/log/nginx/access.log;
​ #access_log off;
}
Author: yuangang_love

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478122.htmlTechArticle1. Install jdk #chmod u+x jdk-6u4-linux-x64.bin #./jdk-6u4 -linux-x64.bin Press the q key and enter yes. A jdk1.6.0_04 directory will be generated in the current directory #mv jdk1.6.0_04 /usr/local/ Configuration environment...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template