The recent deployment of Web systems requires the use of Tomcat processing and Apache consolidation, and Tomcat processing Jsp,apache processing static resources. Do not know how to operate at the beginning, the online access to the material has gone a lot of detours. When it's done, it's easy to find, and now the configuration process is documented below.
1. Installing the Software
Using apt tools (I'm lazy, there are automated tools available, why not) install Apache, Tomcat, and Apache Connector (JK modules), which are 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, the configuration begins.
2.1.tomcat Configuration
Edit File "/var/lib/tomcat8/server.xml"
Turn on AJP Port snooping (Apache will interact with Tomcat via this port)
Save reboot Tomcat
2.2 Apache Configuration
Need to check if JK module is enabled (general installation is enabled automatically)
Method: See if the "/etc/apache2/mods-enabled" directory has "jk.conf", "Jk.load" two files
If not, modify the manually created
The command is as follows:
Ln–s/etc/apache2/mods-available/jk.conf/ete/apache2/mods-enabled/jk.conf
Ln–s/etc/apache2/mods-available/jk.load/ete/apache2/mods-enabled/jk.load
2.3 Interface Module Configuration
Edit File "/etc/libapache2-mod-jk/httpd-jk.conf"
Prohibit proxy for static resources (remove the same comment)
3. Deploy the App
Here is an example of "Zrlog personal blog program";
3.1 Copy Package to tomcat default project directory
Copy the package "Zrlog.war" to "/var/lib/comcat8/webapps/" and restart Tomcat.
Tomcat automatically expands the package, which is now accessible through port 8080 (the Tomcat default port).
3.2 Configuring Vhost
Edit Vhost configuration file
Add configuration options and then restart Apache to access the ports configured by Vhost (e.g. 80)
Debian under Apache and Tomcat integration (using APT tool)