I hope this is the proper forum to post this question...apologies if it is not.

I've been asked to setup drupal under centos 5.6 linux, and am having some trouble understanding how to configure apache 2 virtual hosts for use with Drupal to do what I've been asked. The examples I've found don't seem to correlate with what I've been asked to do. I'll list what I've been asked for below, and ask if anyone can offer advice, or point me to a good resource on it.

the linux server will serve up 2 websites. I've been asked to configure drupal/apache so that x.x.x.x/site1name and x.x.x.x/site2name all point to DocumentRoot of /var/www/html. I've tried using an Alias statement in the virtualhost config, but I get a 404 not found error. Here's the relevant section of my httpd.conf

ServerName server1:80
NameVirtualHost *:80


DocumentRoot "/var/www/html"
# Alias /site1 "/var/www/html"


DocumentRoot "/var/www/html"
# Alias /site2 "/var/www/html"

The desired end result is that http://x.x.x.x/site1 and /site2 both point to the same place -

Comments

kpander’s picture

Sounds like you want an alias (ServerAlias). I'd configure it something like this:

<VirtualHost *:80>
    ServerAdmin webmaster@mysite1.com
    DocumentRoot "/var/www/html"
    ServerName mysite1.com
    ServerAlias mysite2.com
</VirtualHost>

That means mysite1.com and mysite2.com will point to the same location.

Hope that helps!

alexkb’s picture

Just to add to kpanders comment, you actually need to include a Directory definition too.

<VirtualHost *:80>
    ServerAdmin webmaster@mysite1.com
    DocumentRoot "/var/www/html"
    ServerName mysite1.com
    ServerAlias www.mysite1.com

    <Directory />
        Options FollowSymlinks
        AllowOverride All
        order allow,deny
        allow from all
    </Directory>
</VirtualHost>