Multiple Domains point to Different Directory
Lets assume I am running Linode Debian 4.0 with Apache MySql & PHP. How would I configure my box to support multiple domains?
I was able to do this on several VPS's I have used in the past, but it was via some form of control panel.
For example:
Thanks!
13 Replies
@mwalling:
http://httpd.apache.org/docs/2.0/vhosts/
Nice reading material!
> Or you could give this a go.
http://www.linode.com/wiki/index.php/User:Kangaby
Ahha! This is perfect, I will be reviewing every detail of this resource.
I ran into a problem on your wiki.
This is how I configured the default file.
(my website ip address is 67.18.186.137)
#/etc/apache2/sites-available/default
NameVirtualHost 67.18.186.137:80
<virtualhost 67.18.186.137:80="">ServerAdmin root@triptoy.net
DocumentRoot /var/www/
<directory>Options FollowSymLinks
AllowOverride None</directory>
<directory var="" www="">Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# RedirectMatch ^/$ /apache2-default/</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
ServerSignature On
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>
I then configured these two files in the same directory as default, yet for some reason both domains still point to my /var/www
# /etc/apache2/sites-available/triptoy.net
<virtualhost 67.18.186.137:80="">ServerName triptoy.net
ServerAlias www.triptoy.net
DocumentRoot "/home/triptoy.net/public_html"
ScriptAlias /cgi-bin/ /home/triptoy.net/cgi-bin/</virtualhost>
# /etc/apache2/sites-available/slivovitzmusic.com
<virtualhost 67.18.186.137:80="">ServerName slivovitzmusic.com
ServerAlias www.slivovitzmusic.com
DocumentRoot "/home/slivovitzmusic.com/public_html"
ScriptAlias /cgi-bin/ /home/slivovitzmusic.com/cgi-bin/</virtualhost>
Have you restarted Apache, etc/init.d/apache2 restart since setting up the virtual hosts?
I suspect not, as it is not mentioned in the tutorial. When I did my setup, I set everything first and then restarted apache.
Edit: It is now.
Thanks
a2ensite triptoy.net && a2ensite slivovitzmusic.com
?
@OverlordQ:
Did you:
a2ensite triptoy.net && a2ensite slivovitzmusic.com
?
I've added this as well. That's the problem when you go from Apache 1 to Apache 2 and don't write every single thing down.
That's what I always do: set up the symlinks in sites-enabled manually. But I believe that's exactly what the a2ensite tool does.