[thelist] Local apache

sbeam sbeam at syxyz.net
Tue Jan 27 08:12:13 CST 2004


On Tuesday 27 January 2004 06:31, Jeroen Coumans wrote:
> Hi,
> I have several websites which I maintain. To simplify updates to the
> navigation, I've made all links absolute (eg. /about/ instead of
> ../../about/). To test locally, I've installed Apache. However, I'm
> having troubles figuring out how to configure it so that it works
> locally. For example, I have /var/www/website1.com and
> /var/www/website2.com.
>
> Is it possible to configure Apache so that it translates absolute
> links to the respective document root? I've tried aliasing, but that
> only works for one website. I've also read about virtual hosts but
> that seems to require a DNS server, and I'm a bit reluctant to
> complicate my setup unless it's absolutely necessary.

Jeroen - If I understand your question correctly, I think a good 
solution would be to use port-based vhosts - this does not require DNS 
setup. I don't think there is a way to just alias it, since it is your 
web-browser that munges the path when it sees a leading / , not apache.

So in httpd.conf put something like:
Listen 8081
<VirtualHost _default_:8081>
    DocumentRoot /var/www/website1.com
</VirtualHost>

Listen 8082
<VirtualHost _default_:8082>
    DocumentRoot /var/www/website2.com
</VirtualHost>

Then you just go to http://localhost:8081/ and 8082 respectively. If you 
get a lot of sites it gets a bit hard to keep track of, then you will 
want to move to Name-based vhosts and DNS setups.

good luck

-S



More information about the thelist mailing list