It's not a secret anymore!*
The moose likes Tomcat and the fly likes Using Apache/Tomcat on a URL other than localhost Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Using Apache/Tomcat on a URL other than localhost" Watch "Using Apache/Tomcat on a URL other than localhost" New topic
Author

Using Apache/Tomcat on a URL other than localhost

Andy Deighton
Ranch Hand

Joined: Apr 01, 2003
Posts: 39
Hi,
I have successfully got Apache 2.0.47 and Tomcat 4.1.27 working together (using mod_jk 2.0.46). Coolio! It I test from the server itself using http://localhost/examples it works. I was stoked.
Now, if I try to attach to the server from "outside" using it's proper domain, I get a 404. For example: http://www.abc.com/examples. So, I created a virtual host mapping in Tomcat's server.xml, restarted Tomcat so it would re-generate the automatic mod_jk.conf, then restarted Apache, but to no avail. The last step was to remove the default localhost Host section in my Tomcat's server.xml and just leave in my www.abc.com section, but again, it didn't work.
I'm sure I'm missing something in Apache (I have played with it's virtual hosting facility because it's only serving one domain on one IP address). Can anyone help?
Cheers!
Andy (UK)
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

can you post relevant sections of your httpd.conf and server.xml

I'd recommend not using the auto-conf capabilities, but rather manually configuring the jk connectors (even though those auto-conf are easy).
Andy Deighton
Ranch Hand

Joined: Apr 01, 2003
Posts: 39
httpd.conf
ServerName www.ictsqt.co.uk:80
Include c:/tomcat4127/conf/auto/mod_jk.conf
(no virtual host section at all)
mod_jk.conf (a fair chunk of it)
########## Auto generated on Wed Oct 29 21:30:15 GMT 2003##########
<IfModule !mod_jk.c>
LoadModule jk_module c:/apache/Apache2/modules/mod_jk_2.0.46.dll
</IfModule>
JkWorkersFile "c:/tomcat4127/conf/jk/workers.properties"
JkLogFile "c:/tomcat4127/logs/mod_jk.log"
JkLogLevel emerg
<VirtualHost www.ictsqt.co.uk>
ServerName www.ictsqt.co.uk
#################### www.ictsqt.co.uk:/admin ####################
# Static files
Alias /admin "C:/tomcat4127/webapps/../server/webapps/admin"
<Directory "C:/tomcat4127/webapps/../server/webapps/admin">
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.jsp
</Directory>

# Deny direct access to WEB-INF and META-INF
#
<Location "/admin/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/admin/META-INF/*">
AllowOverride None
deny from all
</Location>
#
# Use Directory too. On Windows, Location doesn't work unless case matches
#
<Directory "C:/tomcat4127/webapps/../server/webapps/admin/WEB-INF/">
AllowOverride None
deny from all
</Directory>
<Directory "C:/tomcat4127/webapps/../server/webapps/admin/META-INF/">
AllowOverride None
deny from all
</Directory>
JkMount /admin/j_security_check ajp13
JkMount /admin/*.do ajp13
JkMount /admin/*.jsp ajp13
#################### www.ictsqt.co.uk:/hotelform ####################
# Static files
Alias /hotelform "C:/tomcat4127/webapps/hotelform"
<Directory "C:/tomcat4127/webapps/hotelform">
Options Indexes FollowSymLinks
DirectoryIndex Login.jsp
</Directory>

# Deny direct access to WEB-INF and META-INF
#
<Location "/hotelform/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/hotelform/META-INF/*">
AllowOverride None
deny from all
</Location>
#
# Use Directory too. On Windows, Location doesn't work unless case matches
#
<Directory "C:/tomcat4127/webapps/hotelform/WEB-INF/">
AllowOverride None
deny from all
</Directory>
<Directory "C:/tomcat4127/webapps/hotelform/META-INF/">
AllowOverride None
deny from all
</Directory>
JkMount /hotelform/*.jsp ajp13
JkMount /hotelform/*.action ajp13
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Apache/Tomcat on a URL other than localhost
 
Similar Threads
Request to Tomcat from remote machine
Virtual Host with Apache 2 and Tomcat 4.1
Virtual Directory
The requested resource is not available
how to forward from the root