1. install java
Sudo apt-get install sun-java6-jdk sun-java6-fonts sun-java6-plugin
Jre may be installed first.
Sudo update-java-alternatives-s java-6-sun
2. Environment Variables
Sudo vim/etc/environment
Add JAVA_HOME =/usr/lib/jvm/java-6-openjdk/
Change PATH to the following
PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/lib/jvm/java-6-openjdk/bin /"
3. install apache
Sudo apt-get install apache2
Then sudo/etc/init. d/apache2 start/stop/restart can be started.
Start the browser and check the result by entering 127.0.0.1 in the address bar.
The/etc/init. d/apache2 and/usr/sbin/apachectl functions the same, but they are automatically executed in/etc/init. d.
Any settings to be modified are added to/etc/apache2/httpd. conf.
4. install tomcat
Sudo apt-get install tomcat6 tomcat6-common tomcat6-docs tomcat6-examples libtomcat6-java
Similarly, start/etc/init. d/tomcat6 start/stop/restart
5. Security of mod_jk
In this way, apache and tomcat should be able to run normally, but they do not know each other. www.linuxidc.com needs mod_jk to connect them together.
Sudo apt-get install libapache2-mod-jk
/Usr/lib/apache2/modules/mod_jk.so is the module responsible for apache to submit the request to tomcat for processing.
Then copy/usr/share/doc/libapache2-mod-jk/httpd_example_apache2.con content directly to/etc/apache2/httpd. conf,
6. Verification
Sudo gedit/etc/apache2/httpd. conf
# Gedit. You can paste it directly to the end.
Alias/examples "/usr/share/tomcat6-examples/examples"
<Directory "/usr/share/tomcat6-examples/examples">
Options Indexes FollowSymLinks
AllowOverride None
Order allow, deny
Allow from all
</Directory>
#/Tomcat6-examples/examples from sudo apt-get install tomcat6 tomcat6-examples
Restart apache2 and enter http: // localhost/examples in the browser to check whether the request is successful.