View previous topic :: View next topic |
Author |
Message |
gcrew Tux's lil' helper
Joined: 22 Feb 2005 Posts: 82 Location: Poughkeepsie, NY
|
Posted: Fri Aug 19, 2005 3:28 pm Post subject: Serving Multiple Domain Names with Apache |
|
|
I have a couple domain names from DynDNS and would like some of my web content to be available if accessed from one domain name and other content to be available if accessed from the other domain name. There is no shared content between domain names. Is there a way to do this?
Geoff |
|
Back to top |
|
|
trossachs Veteran
Joined: 22 Jan 2004 Posts: 1204 Location: London
|
Posted: Fri Aug 19, 2005 3:38 pm Post subject: |
|
|
Do you not mean virtual hosts, where various domain.com addreses are served by the same server? |
|
Back to top |
|
|
gcrew Tux's lil' helper
Joined: 22 Feb 2005 Posts: 82 Location: Poughkeepsie, NY
|
Posted: Fri Aug 19, 2005 5:41 pm Post subject: |
|
|
I probably do mean virtual hosts. Could you help explain how to set them up? I assume I need to reinstall my webapps with the vhosts USE flag set. I haven't gotten very far so uninstalling and reinstalling everything isn't a big deal. Thanks.
Geoff |
|
Back to top |
|
|
the_mgt Apprentice
Joined: 05 Aug 2005 Posts: 259 Location: Germany, near Hannover
|
|
Back to top |
|
|
gcrew Tux's lil' helper
Joined: 22 Feb 2005 Posts: 82 Location: Poughkeepsie, NY
|
Posted: Mon Aug 22, 2005 10:39 pm Post subject: |
|
|
I'm afraid that howto is far too detailed to be of any use to me. I'll tell you exactly what I want to do.
I have two domains I got from dyndns. I want to serve requests based on which name was used. If domain1 or localhost or my ip are used, I'd like to serve files from /var/www/localhost. If domain2 is used I'd like to server files from /var/www/domain2. Here is the entirety of the /etc/apache2/conf/vhosts/vhosts.conf file I tried using:
Code: | <VirtualHost *:81>
ServerName domain2
DocumentRoot /var/www/domain2
</VirtualHost> |
Whenever I include this from apache2.conf, both addresses say you don't have permission to view this page.
Thanks for any more help you can give.
Geoff |
|
Back to top |
|
|
the_mgt Apprentice
Joined: 05 Aug 2005 Posts: 259 Location: Germany, near Hannover
|
Posted: Mon Aug 22, 2005 11:06 pm Post subject: |
|
|
Yes Apache configuration is complex...
Try this here:
Code: |
<VirtualHost *:81>
ServerName domain2
DocumentRoot /var/www/domain2
<Directory "/var/www/domain2">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
|
|
|
Back to top |
|
|
gcrew Tux's lil' helper
Joined: 22 Feb 2005 Posts: 82 Location: Poughkeepsie, NY
|
Posted: Tue Aug 23, 2005 1:26 pm Post subject: |
|
|
I did what you said and then everything was going to domain2. This is what finally got it working:
Code: | NameVirtualHost *:81
<VirtualHost *:81>
ServerName localhost
DocumentRoot /var/www/localhost/htdocs
</VirtualHost>
<VirtualHost *:81>
ServerName domain2
DocumentRoot /var/www/domain2
<Directory "/var/www/domain2">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost> |
I guess this makes sense. I have to name both hosts in VirtualHost tags. The first host already has a Directory definition, but the second needs to define its own or use the default. The default is found in commonapache2.conf. It's extremely restrictive so this is necessary. Thanks for the help.
Geoff |
|
Back to top |
|
|
|