Debian Apache and tomcat integration (using apt tool), debianapt
Recently deployed web systems require the use of tomcat for integrated use with Apache, tomcat for JSP processing, and Apache for static resources. I didn't know how to operate it at first, and I had a lot of detours when I checked the information online. The configuration process is recorded as follows.
1. Install software
Install Apache, tomcat, and Apache Connector (jk module) using apt tools (I am relatively lazy and can use automation tools ), jk module is used for direct interaction between Apache and tomcat.
The command is as follows:
Apt-get install apache2 tomcat8 libapache2-mod-jk
2. Configuration
After the installation is complete, start the configuration.
2.1.tomcat Configuration
Edit the file "/var/lib/tomcat8/server. xml"
Enable ajp port listening (Apache will use this port to interact with tomcat)
Save and restart tomcat
2.2 Apache configuration
Check whether the jk module is enabled (generally, it is automatically enabled after successful installation)
Method: Check whether "jk. conf" and "jk. load" files exist in the "/etc/apache2/mod-enabled" directory.
If not, modify the manual Creation
The command is as follows:
Ln-s/etc/apache2/mod-available/jk. conf/ete/apache2/mod-enabled/jk. conf
Ln-s/etc/apache2/mod-available/jk. load/ete/apache2/mod-enabled/jk. load
2.3 interface module configuration
Edit File '/etc/libapache2-mod-jk/httpd-jk.conf"
Do not proxy static resources (just remove the comments below)
3. Deploy the application
Here, we use the "Zrlog personal blog program" as an example;
3.1 copy the software package to the tomcat default project directory
Copy the "zrlog. war" package to "/var/lib/comcat8/webapps/" and restart tomcat.
Tomcat automatically expands the software package, which can be accessed through port 8080 (default tomcat port.
3.2 configure vhost
Edit the vhost configuration file
Add configuration options, restart Apache, and access through the vhost configured port (such as 80)