The unit needs a php project, but there is only one domain name. The server operating system is redhat 4.7 and tomcat has been deployed. It is impossible to redo or merge it, but it must share the same host. I thought of using apache http server. jk connected to tomcat, installed php and mysql, it took a lot of time, and finally succeeded, the records are as follows:
1. Redhat4.7 installs yum
Redhat4.7 does not have yum installed by default. It is indeed better to install software with yum than rpm. It’s convenient and you don’t have to worry about dependencies, but sometimes the package can’t be found.
Redhat5 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 tar xzvf yum_forAS4.tar. gz
Enter the directory cd yum_forAS4 #
Installation rpm -ivh *.rpm
cd /etc/yum.repos.d/
vi CentOS-Base.repo
# CentOS-Base.repo [base] name=CentOS-4.7 - Base - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/os/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #released updates [updates] name=CentOS-4.7 - Updates - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/updates/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #additional packages that may be useful [extras] name=CentOS-4.7 - Extras - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/extras/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #packages used/produced in the build but not released [addons] name=CentOS-4.7 - Addons - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/addons/$basearch/ gpgcheck=1 gpgkey=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.cn baseurl=http://vault.centos.org/4.7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #contrib - packages by Centos Users [contrib] name=CentOS-4.7 - Contrib - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4
yum makecache
yum is installed, you can use yum -y in the future install
2. Install 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 them all with one command. The php-mcrypt package is not installed. There will be a warning in phpMyAdmin, so install it.
Look for the following packages at 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.
The apache configuration file is installed in /etc/httpd/conf, and the WEB directory is installed in /var/www/
Start: service httpd start
Stop: service httpd stop
mysql Start service mysqld start Stop service mysql stop
Set mysql account and password (omitted)
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, as mentioned in the article If you need apxs, this program is installed in the httpd-devel package. To find the location of apxs, use
rpm -ql httpd-devel
...
/usr/sbin/apxs
...
In fact, apache http server can The executable files are placed in the /usr/sbin/ directory, which is in the PATH environment variable.
./configure --with-apxs=/usr/sbin/apxs
make
generated two directories, apache-1.3 and apache-2.0, in the current directory. We are using apache2.0
cd apache-2.0
cp mod_jk.so /etc/httpd/modules/
4. Configure jk.
(1) Create workers.properties configuration file
cd /etc/httpd/conf
vi workers.properties # Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
Add the following line under the loading module paragraph
# Load mod_jk module # Update this path to match your modules location LoadModule jk_module modules/mod_jk.so # Where to find workers.properties # Update this path to match your conf directory location (put workers.properties next to httpd.conf) JkWorkersFile /etc/httpd/conf/workers.properties # Where to put jk shared memory # Update this path to match your local state directory or logs directory JkShmFile /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 format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # Send everything for context /examples to worker named worker1 (ajp13) JkMount /examples/* worker1
Test:
It can be accessed through the tomcat port, and the same content can also be accessed through the apache port.
If you use a firewall, remember to open port 8009 of lo
-A INPUT -i lo -p tcp -m tcp --dport 8009 -j ACCEPT
Okay, put it here, and you won’t be unable to find it next time you configure it .