search
Homephp教程php手册php和java环境整合

php和java环境整合

Jun 13, 2016 am 10:50 AM
javajdkphpandInstallaccording toIntegrateenvironment

1、安装jdk
   #chmod u+x jdk-6u4-linux-x64.bin
   #./jdk-6u4-linux-x64.bin
   按‘q’键,输入yes在当前目录下会产生一个jdk1.6.0_04的目录
   #mv jdk1.6.0_04 /usr/local/
   配置环境变量
   #vim /etc/profile
   加入
   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
   查看
   #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)
   表示成功!

2、安装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/
   配置环境变量
   #vim /etc/profile
   TOMCAT_HOME=/usr/local/apache-tomcat-6.0.16
   export TOMCAT_HOME
   #source /etc/profile
   启动
   #/usr/local/apache-tomcat-6.0.16/bin/startup.sh
   默认启动端口在8080上
3、配置nginx实现同时解析jsp和php文件
   #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;
   }
作者:yuangang_love

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools