Host concurrently running JSP and PHP

Source: Internet
Author: User
Tags mcrypt php and mysql php mysql
Units need a PHP project, but only one domain name, the server operating system is Redhat 4.7, has been the deployment of Tomcat, redo or merge is not possible, but must share a host, think of the Apache HTTP server, with JK and Tomcat connection, The installation of PHP and MySQL, and spent a lot of time, and finally succeeded, is now recorded as follows:
1. redhat4.7 Install Yum
redhat4.7 does not install Yum by default, installing the software with Yum is actually more convenient than RPM, dependencies are not considered, but sometimes there is no time to find the package.
REDHAT5 already has Yum installed by default, just configure it directly.
Download Yum wget http://www.parallels.com.cn/downloads/Prima/Tools/yum_forAS4.tar.gz
Unzip the tar xzvf yum_forAS4.tar.gz
Go to catalog CD YUM_FORAS4 #
Installing RPM-IVH *.rpm
cd/etc/yum.repos.d/
VI Centos-base.repo

# centos-base.repo[base]name=centos-4.7-base-mirrors.ustc.edu.cnbaseurl=http://vault.centos.org/4.7/os/$ Basearch/gpgcheck=1gpgkey=http://vault.centos.org/rpm-gpg-key-centos-4#released updates[updates]name=CentOS-4.7 -Updates-mirrors.ustc.edu.cnbaseurl=http://vault.centos.org/4.7/updates/$basearch/gpgcheck=1gpgkey=http:// Vault.centos.org/rpm-gpg-key-centos-4#additional packages that could be Useful[extras]name=centos-4.7-extras- mirrors.ustc.edu.cnbaseurl=http://vault.centos.org/4.7/extras/$basearch/gpgcheck=1gpgkey=http:// Vault.centos.org/rpm-gpg-key-centos-4#packages used/produced in the build and not released[addons]name=centos-4.7- addons-mirrors.ustc.edu.cnbaseurl=http://vault.centos.org/4.7/addons/$basearch/gpgcheck=1gpgkey=http:// Vault.centos.org/rpm-gpg-key-centos-4#additional packages that extend functionality of existing Packages[centosplus] name=centos-4.7-plus-mirrors.ustc.edu.cnbaseurl=http://vault.centos.org/4.7/centosplus/$basearch/gpgcheck= 1enabled=0gpgkey=Http://vault.centos.org/RPM-GPG-KEY-CentOS-4#contrib-packages by CentOS Users[contrib]name=centos-4.7-contrib- mirrors.ustc.edu.cnbaseurl=http://vault.centos.org/4.7/contrib/$basearch/gpgcheck=1enabled=0gpgkey=http:// Vault.centos.org/rpm-gpg-key-centos-4

Yum Makecache
Yum installation is complete and it is convenient to install the software with the Yum-y install < package name > Command later.

2, Installation Apache,php,mysql
Yum-y install httpd httpd-devel php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt PHP-GD php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql
Install all with a single command, Php-mcrypt This package is not installed, there will be a warning in the phpMyAdmin, or load it.
Look for the following packages on http://rpm.pbone.net/:
libmcrypt-2.5.7-5.el4.i386.rpm
php-common-5.3.10-2.el4.remi.i386.rpm
php-mcrypt-4.3.9-1.el4.i386.rpm
Install the above package.
Apache configuration file installed in the/etc/httpd/conf,web directory with/var/www/installed
Start: Service httpd start
STOP: Service httpd stop
MySQL start service mysqld start stop service MySQL stop
Set MySQL account number and password (slightly)

3. Compile and install Tomcat connectors
wget tomcat-connectors-1.2.37-src.tar.gz
CD TOMCAT-CONNECTORS-1.2.37-SRC
CD native
Read the BUILDING.txt file carefully, the article mentions the need to APXS, this program is installed in the Httpd-devel package
Find the location of the APXS, using
RPM-QL Httpd-devel
...
/usr/sbin/apxs
...
In fact, Apache HTTP server executable files are placed in the/usr/sbin/directory, the directory in the PATH environment variable.
./configure--with-apxs=/usr/sbin/apxs
Make
The apache-1.3 and apache-2.0 two directories are generated under the current directory, and we use the apache2.0
CD apache-2.0
CP mod_jk.so/etc/httpd/modules/

4, configure JK.
(1) Create a workers.properties configuration file
Cd/etc/httpd/conf
VI workers.properties

# Define 1 Real worker using ajp13worker.list=worker1# Set properties for Worker1 (AJP13) worker.worker1.type=ajp13worker. worker1.host=localhostworker.worker1.port=8009

(2) Edit httpd.conf
Add a line under the Load module paragraph

# Load mod_jk module# Update This path to match your modules Locationloadmodule J  K_module modules/mod_jk.so# Where to find workers.properties# Update this path to the match your Conf directory location (put Workers.properties next to httpd.conf) jkworkersfile/etc/httpd/conf/workers.properties# Where to put JK Gkfx shared memory# up Date this path to the match your local state directory or logs directoryjkshmfile/var/log/httpd/mod_jk.shm# Where to put JK logs# Update This path to match your logs directory location (Put Mod_jk.log next to Access_log) jklogfile/var/log/ httpd/mod_jk.log# Set the JK log level [Debug/error/info]jkloglevel info# Select the timestamp log formatjklogstampform At "[%a%b%d%h:%m:%s%Y]" # Send everything for context/examples to worker named Worker1 (ajp13) jkmount/examples/* wo Rker1 

Restart Apache

Test:
The port of Tomcat is accessible, and the same content can be accessed with Apache ports.
If you use a firewall, remember to open the LO Port 8009
-A input-i lo-p tcp-m tcp--dport 8009-j ACCEPT
OK, put it here, the next configuration will not be found.

  • Related Article

    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.