Forum OpenACS Q&A: Virtual Hosts for the same "domain name"

I am using OACS, with Redhat 7.2.
I use Apache 1.3.27, I have configured Apache to run different sites with the same ip address, here is the configuration of my httpd.conf file for the site www.foo.net:

<VirtualHost 1.2.3.4>
  ServerAdmin webmaster@foo.net
  ServerName foo.net
  ServerAlias www.foo.net
  ProxyPass / http://1.2.3.4:17000/
  ProxyPassReverse / http://1.2.3.4:17000/
  ErrorLog logs/foo.net-error_log
  CustomLog logs/foo.net-access_log common
</VirtualHost>

Now I need to have different sites running under the same "domain name" like for example:
www.foo.net/site1
www.foo.net/site2
www.foo.net/site3

What I did was just to modify the configuration of the httpd.conf file, to run site1 that is running on port 18000, but it doesn't work.
Here is how I did it:

<VirtualHost 1.2.3.4>
  ServerAdmin webmaster-site1@foo.net
  ServerName foo.net/site1/
  ServerAlias www.foo.net/site1/
  ProxyPass / http://1.2.3.4:18000/
  ProxyPassReverse / http://1.2.3.4:18000/
  ErrorLog logs/site1-foo.net-error_log
  CustomLog logs/site1-foo.net-access_log common
</VirtualHost>

This is not working and I don't know where the problem is. Does anyone have any idea?


Thanks.
Collapse
Posted by Patrick Giagnocavo on
Close, but actually, it is easier than what you have setup.

Keep the original entry, but add additional ProxyPass directives to cover the directories you care about, e.g.

ProxyPass /site1 http://1.2.3.4:18000/
ProxyPass /site2 http://1.2.3.4:19000/
ProxyPass /site3 http://1.2.3.4:20000/

and the proper Reverse entries as well.

However, depending on how many of these redirects there are, you may want to use the mod_rewrite module, or just install a number of redirects.

Yet another way is to add a number of DNS entries such as site1.foo.net, site2.foo.net etc. and redirect all requests to those hostnames.  Then create a vhost setup for each site.