Configuration of java and php heterogeneous systems

Source: Internet
Author: User
Java and php heterogeneous system configuration (for horizontal scaling) (date:) 1. first install and configure apache and php5, and test it by yourself. 2. the steps for integrating windows and linux with apachetomcat are similar. write only linux. first, configure linu java and php heterogeneous systems.
Configuration of java and php heterogeneous systems (for horizontal scaling) (date)

1. first install and configure apache and php5, and test it by yourself.


2. apache tomcat integration

The steps for windows and linux are similar.

First download java from linux, preferably JDK 1.6 or later. Install the java environment. There are introductions on the Internet. Suppose the ip address of the linux machine is 192.168.1.2.

Download tomcat6.0, install tomcat, and run tomcat/bin/startup. sh, and then enter the browser by looking for a machine, http: // 192.168.1.2: 8080/test. if you see the cat page, OK.

Below is the integration of apache and tomcat

Step 2: Download the jk dynamic connection library and go to the http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/
Go to the appropriate directory and download it based on the system and apache version.

Step 2: Put the downloaded file mod_jk ***. so under $ apache_home/modules.

Step 2: Open tomcat/conf/server. xml
Find This line
Add a line below this line and save it

Obviously, the content in modJk = "D: \ Apache2 \ modules \ mod_jk.so" double quotation marks should be based on the complete path and file name of the operating system from the root directory to mod_jk ***. so.

Step 2: Next, in linux
Go to the tomcat/bin directory and run the following commands to restart tomcat 6:

./Catalina. sh stop
./Catalina. sh start

Step 2: Normally, you will find two more directories, auto and jk, in tomcat/conf.
In this case, go to the auto Directory, open the file, and copy the content,
Go to the apache/conf directory of linux and Open httpd. conf.
Copy the content just now to the end of the httpd. conf file. the content is actually two
One is to load a module.
One is to specify which directories the browser accesses will take the initiative to search for tomcat.

Step 2: add another sentence
DirectoryIndex index.html index. php index. jsp
Note: If you search for the existing DirectoryIndex command line in the httpd. conf file before adding this sentence, comment out the line first to avoid conflict.

Step 2: save httpd. conf and restart apache. generally, go to the directory where apache/bin is located and run
./Apachectl stop
./Apachectl start
If it cannot be started, the httpd. conf file is incorrect and needs to be adjusted by yourself.



Now, if you enter
Http: // 192.168.1.2/examples/jsp/jsp2/tagfiles/hello. jsp
The jsp page is displayed correctly.
Note: as long as the browser does not specify a port when entering the url, port 80 is used to access the remote server.
We can know that the page must be transferred to tomcat through apache, because tomcat only listens to port 8080, not port 80, without modifying the configuration.
Apache listens only to port 80 by default.
Tomcat can now listen to port 8080 and give a response,
Browser input
Http: // 192.168.1.2: 8080/examples/jsp/jsp2/tagfiles/hello. jsp
The same result is displayed.

Http: // 192.168.1.2/phpinfo. php
You can also access the php program.

You can use the firewall to block port 8080 of linux so that tomcat can only receive apache requests from the local machine for forwarding.
Of course, it is better to open only ports 80 and 22, because tomcat has other ports.

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.