RE: [users@httpd] Virtual Host Configuration Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Don't know about mod_jk, but if you are not using any particular functionality of the module other than tranferring the request to a backend server, you might just as well use reverse proxying.

I would think something like this would work:

Listen *:80
RewriteEngine On
UseCanonicalName Off
ProxyPreserveHost On

# Grab the host name (without the domain)
RewriteCond %{HTTP_HOST}      ^([^\.]+)
# Does the first path element match the host name ?
RewriteCond %{REQUEST_URI}    !^/%1
# Proxy the request to the backend server prefixing the path with the host name.
RewriteRule ^(.*)             http://localhost:8280/%1$1 [P]

RewriteRule ^(.*)             http://localhost:8280$1 [P]

ProxyPassReverse / 		http://localhost:8280



-ascs

-----Original Message-----
From: James Howe [mailto:lists@xxxxxxxxxxxxxxxxxxxxxxxx] 
Sent: Thursday, February 16, 2006 10:11 PM
To: users@xxxxxxxxxxxxxxxx
Subject: [users@httpd] Virtual Host Configuration Question

I'm trying to configure an Apache 2.x installation to use two virtual hosts using name based virtual host definitions.  I have Tomcat 5.x running two different web applications and I want to map particular server names to particular web apps.  For example, if I were talking to Tomcat directly I would do this:

http://localhost:8280/app1/*

and

http://localhost:8280/app2/*

What I want to do is configure Apache so the URL's would look like this:

http://app1.foo.bar/*  (where * may be nothing, or some path supported by the app)

and

http://app2.foo.bar/* (where * may be nothing, or some path supported by the app)

The closest thing that works for me are the following URLs:

http://app1.foo.bar/app1/*

and

http://app2.foo.bar/app2/*

I'm using mod_jk to to the connection between Apache and Tomcat.  My virtual host configurations look something like this:

<VirtualHost *:80>
     ServerName app1
     DocumentRoot ... tomcat web app directory ...
     RewriteEngine on
     RewriteRule   ^/$  /app1
     JkMount /app1 tomcat1
     JkMount /app1/* tomcat1
</virtualHost>

What am I missing?

Any help would be appreciated.

Thanks!

--
James Howe

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux