Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Serving Multiple Domain Names with Apache
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
gcrew
Tux's lil' helper
Tux's lil' helper


Joined: 22 Feb 2005
Posts: 82
Location: Poughkeepsie, NY

PostPosted: Fri Aug 19, 2005 3:28 pm    Post subject: Serving Multiple Domain Names with Apache Reply with quote

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
View user's profile Send private message
trossachs
Veteran
Veteran


Joined: 22 Jan 2004
Posts: 1204
Location: London

PostPosted: Fri Aug 19, 2005 3:38 pm    Post subject: Reply with quote

Do you not mean virtual hosts, where various domain.com addreses are served by the same server?
Back to top
View user's profile Send private message
gcrew
Tux's lil' helper
Tux's lil' helper


Joined: 22 Feb 2005
Posts: 82
Location: Poughkeepsie, NY

PostPosted: Fri Aug 19, 2005 5:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
the_mgt
Apprentice
Apprentice


Joined: 05 Aug 2005
Posts: 259
Location: Germany, near Hannover

PostPosted: Sat Aug 20, 2005 2:50 am    Post subject: Reply with quote

The vhosts flag is just for some special applications, your apache does it without.
Look at this howto here for further information: http://gentoo-wiki.com/HOWTO_Linux_Virtual_Hosting_Server
Back to top
View user's profile Send private message
gcrew
Tux's lil' helper
Tux's lil' helper


Joined: 22 Feb 2005
Posts: 82
Location: Poughkeepsie, NY

PostPosted: Mon Aug 22, 2005 10:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
the_mgt
Apprentice
Apprentice


Joined: 05 Aug 2005
Posts: 259
Location: Germany, near Hannover

PostPosted: Mon Aug 22, 2005 11:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
gcrew
Tux's lil' helper
Tux's lil' helper


Joined: 22 Feb 2005
Posts: 82
Location: Poughkeepsie, NY

PostPosted: Tue Aug 23, 2005 1:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum