Multi domain on my dedicated server with Apache2

Posted by x4vier on Server Fault See other posts from Server Fault or by x4vier
Published on 2012-09-03T14:18:56Z Indexed on 2012/09/03 15:40 UTC
Read the original article Hit count: 306

Filed under:
|

I setup a server with Ubuntu 10.04 server edition. It's works for a long time with a single domain name. Now i want to add another domain wich will pointed to a new directory.

I tried to change my Apache2 configuration but it does not seems to work properly.

Here is my /etc/apache2/sites-available/default

<VirtualHost *:80>
DocumentRoot /var/www/
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

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

</VirtualHost>

<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/mydomain
</VirtualHost> 

here is my /etc/hosts

127.0.0.1 localhost

**.***.133.29   sd-***.****.fr sd-****
**.***.133.29   mediousgame.com

 # The following lines are desirable for IPv6 capable hosts 
 ::1     localhost ip6-localhost ip6-loopback
 ****::0 ip6-localnet
 ****: :0 ip6-mcastprefix
 ****::1 ip6-allnodes
 ****::2 ip6-allrouters
 ****::3 ip6-allhosts

With this configuration when i try to access to mydomain it redirect to the /var/www/ content. Do you have any idea to redirect to the right folder ?

© Server Fault or respective owner

Related posts about apache2

Related posts about multiple-domains