Windows - XAMPP Apache Tomcat
Here is a description of how I got Tomcat running kindly with
my other virtual hosts. I don't use Tomcat much and I'm no
Apache expert so there may be other problems in the pipe;
as always your mileage my vary - back up your install first.
* Installing XAMPP with Tomcat *
Extract the XAMPP install to c:\xampp.
run c:\xampp\setup_xampp.bat.
Run Apache from the XAMPP control panel and check it works.
Stop Apache.
Extract the Tomcat install to c:\xampp.
run c:\xampp\setup_xampp.bat.
Run Tomcat then Apache from the XAMPP control panel and check
they both work.
* Modify hosts files *
In "C:\WINDOWS\system32\drivers\etc\hosts" add some host names
for your virtual hosts, including an independent one for Tomcat -
127.0.0.1 hostxampp.com
127.0.0.1 yourserver.com
127.0.0.3 tomcathost - use an unassigned local ip address
* Modify the Apache configuration *
In "C:\xampp\apache\conf\httpd.conf" added the following at
the end of the file -
Include "conf/myconf.conf"
Create the file "C:\xampp\apache\conf\myconf.conf" and include
the following -
- Code: Select all
NameVirtualHost *:80
## XAMPP Host - Primary Host to enable all XAMPP status functions to work
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName hostxampp.com
ErrorLog "logs/hostxampp-error.log"
CustomLog "logs/hostxampp-access.log" combined
</VirtualHost>
## Another virtual host
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/yourdocs"
ServerName yourserver.com
ErrorLog "logs/yourserver-error.log"
CustomLog "logs/yourserver-access.log" combined
</VirtualHost>
* Modify the Tomcat configuration *
Edit the file "c:\xampp\tomcat\conf\server.xml" in two
places using our Tomcat host name -
<Engine name="Catalina" defaultHost="localhost">
becomes
<Engine name="Catalina" defaultHost="tomcathost">
and
<Host name="localhost" appBase="webapps"
becomes
<Host name="tomcathost" appBase="webapps"
Edit the file "c:\xampp\tomcat\conf\jk\workers.properties"
in two places using our Tomcat host name -
worker.ajp12.host=tomcathost
and
worker.ajp13.host=tomcathost
Now, when you start Tomcat it will auto generate
"c:\xampp\tomcat\conf\auto\mod_jk.conf". If you examine
this file you should see the VirtualHost and ServerName
changed to tomcathost. If this is so your other virtual
hosts should start working again.
Use XAMPP control panel; start Tomcat then Apache.
Test with:
http://localhost/xampp/ - XAMPP status pages
http://tomcathost/examples/ - Tomcat examples
http://yourserver.com/ - other virtual host
Note that the link to the java examples from the XAMPP
status page will now be incorrect, the new url
is
http://tomcathost/examples/