-   Debian (
-   -   Problems setting up virtual hosts with debian sarge and apache2 (

dthacker 11-20-2005 09:52 AM

Problems setting up virtual hosts with debian sarge and apache2
Versions: Debian Sarge, Apache2
Goal: Set up apache2 with a virtual servers. If I type "pince" into the browser, I want to go to the default page. If I type in "rt", I want to go to the home page for virtual host rt.

What I've done so far:
-added my two hosts to the /etc hosts file like this:
Code:      localhost.localdomain  localhost      pince rt
-verified that apache is running
-typed in "pince" in a locally run browser and gotten the apache2 default page
-copied the /etc/apache2/available-sites/default file to /etc/apache2/available-sites/rt
-change the DocumentRoot and Directory settings in rt to /var/www/rt
-created directory /var/www/rt shame with same permissions as /var/www/apache2-default
-copied over the index.html.en file to /var/www/rt and changed the contents so I know when I hit it.
-in directory /etc/apache2/sites-enabled, I created a symbolic link

ln -s /etc/apache2/sites-available/rt rt
-restarted apache with /etc/init.d/apache2 restart (restarted without error)

What happens

When I type in "pince", I now get a 404 error. Here's the error log:

[Sun Nov 20 09:48:24 2005] [debug] /home/adconrad/build/apache2/security/sarge/apache2-2.0.54/build-tree/apache2/modules/mappers/mod_alias.c(438): [client] incomplete redirection target of '/apache2-default/' for URI '/' modified to 'http://pince/apache2-default/'
[Sun Nov 20 09:48:24 2005] [error] [client] File does not exist: /var/www/rt/apache2-default

If I remove the link to rt in active-sites and restart apache. Apache behaves normally. Any ideas as to what I'm breaking? Pointers to docs on creating vhosts The Debian Way?
TIA Dave

funkyHat 11-23-2005 05:25 PM

I just set up apache2 today, here should be the solution:
You need to remove line 17 from the rt configuration file:

RedirectMatch ^/$ /apache2-default/
As it is pointing to a directory named apache2-default in rt's webroot, which doesn't exist.

You may also want to remove this section, which effectively symlinks in the apache2 documentation into your virtualhost. It won't hurt to leave it in though.

Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128

All times are GMT -5. The time now is 07:15 AM.