Home Backend Development PHP Tutorial The host runs both JSP and PHP

The host runs both JSP and PHP

Nov 22, 2016 pm 04:26 PM
tomcat

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
Copy after login

yum makecache
yum is installed, you can use yum -y in the future install command to install software, which is very convenient.

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
Copy after login

(2) Edit httpd.conf

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
Copy after login
Restart apache


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 .

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

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 Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to deploy jar project in tomcat How to deploy jar project in tomcat Apr 21, 2024 am 07:27 AM

To deploy a JAR project to Tomcat, follow these steps: Download and unzip Tomcat. Configure the server.xml file, set the port and project deployment path. Copies the JAR file to the specified deployment path. Start Tomcat. Access the deployed project using the provided URL.

How to allow external network access to tomcat server How to allow external network access to tomcat server Apr 21, 2024 am 07:22 AM

To allow the Tomcat server to access the external network, you need to: modify the Tomcat configuration file to allow external connections. Add a firewall rule to allow access to the Tomcat server port. Create a DNS record pointing the domain name to the Tomcat server public IP. Optional: Use a reverse proxy to improve security and performance. Optional: Set up HTTPS for increased security.

Where is the tomcat installation directory? Where is the tomcat installation directory? Apr 21, 2024 am 07:48 AM

Tomcat installation directory: Default path: Windows: C:\Program Files\Apache Software Foundation\Tomcat 9.0macOS:/Library/Tomcat/Tomcat 9.0Linux:/opt/tomcat/tomcat9 Custom path: You can specify it during installation. Find the installation directory: use whereis or locate command.

How to deploy multiple projects in tomcat How to deploy multiple projects in tomcat Apr 21, 2024 am 09:33 AM

To deploy multiple projects through Tomcat, you need to create a webapp directory for each project and then: Automatic deployment: Place the webapp directory in Tomcat's webapps directory. Manual deployment: Manually deploy the project in Tomcat's manager application. Once the project is deployed, it can be accessed by its deployment name, for example: http://localhost:8080/project1.

How to check the number of concurrent connections in tomcat How to check the number of concurrent connections in tomcat Apr 21, 2024 am 08:12 AM

How to check the number of concurrent Tomcat connections: Visit the Tomcat Manager page (http://localhost:8080/manager/html) and enter your user name and password. Click Status->Sessions in the left navigation bar to see the number of concurrent connections at the top of the page.

Where is the root directory of the tomcat website? Where is the root directory of the tomcat website? Apr 21, 2024 am 09:27 AM

The Tomcat website root directory is located in Tomcat's webapps subdirectory and is used to store web application files, static resources, and the WEB-INF directory; it can be found by looking for the docBase attribute in the Tomcat configuration file.

How to check the port number of tomcat How to check the port number of tomcat Apr 21, 2024 am 08:00 AM

The Tomcat port number can be viewed by checking the port attribute of the <Connector> element in the server.xml file. Visit the Tomcat management interface (http://localhost:8080/manager/html) and view the "Status" tab. Run "catalina.sh version" from the command line and look at the "Port:" line.

How to configure domain name in tomcat How to configure domain name in tomcat Apr 21, 2024 am 09:52 AM

To configure Tomcat to use a domain name, follow these steps: Create a server.xml backup. Open server.xml and add the Host element, replacing example.com with your domain name. Create an SSL certificate for the domain name (if required). Add an SSL connector in server.xml, change the port, keystore file, and password. Save server.xml. Restart Tomcat.

See all articles