Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How do Apache Virtual Hosts work?
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
ZHQ
n00b
n00b


Joined: 31 Dec 2009
Posts: 59
Location: Here

PostPosted: Mon Dec 27, 2010 5:09 am    Post subject: How do Apache Virtual Hosts work? Reply with quote

I've done a somewhat cursory search on the Gentoo website, google, as well as this subforum and a few books as well, but I still seem to be a bit unclear about Apache's virtual host features. I was wondering if anyone could clarify a few things on my comprehensive understanding of how it all works.

By looking around on my current gentoo setup, I see that you have to enable it in the APACHE2_OPTS setting in the /etc/conf.d/apache2 file. There is -D DEFAULT_VHOST and -D SSL_DEFAULT_VHOST already setup for you. So Question 1: Why are all the subsequent settings in this file commented out? I noticed that CONFIGFILE points to /etc/apache2/httpd.conf and that SERVERROOT is also in httpd.conf. Isn't this the file that contains all the "global" settings or something? What is the relationship between /etc/apache2/httpd.conf and /etc/conf.d/apache2?

The settings of a virtual host are contained in files that have <IfDefine NAME> tags? The DEFAULT_VHOST and SSL_DEFAULT_VHOST are defined in the files 00_default_vhost.conf and 00_default_ssl_vhost.conf, repectively. Um, Question 2: Do these files need to have a specific name format (eg, 00_something or ##_something.conf)? Do they have to be in /etc/apache2/vhosts.d? Actually, even better would be if you could tell me what file or parameter specifies where these definitions are searched for.

If you look in the same directory as these files (/etc/apache2/vhosts.d), you can see the default_vhost.include file. Question 3: It also seems to contain documentroot and serverroot settings. Do these override the ones in httpd.conf and other places? It seems to ask once again for the same settings that httpd.conf and /etc/conf.d/apache2 ask for. I noticed that it is included from the default vhost configuration file. Is this necessary or just a readibility thing?

Lastly is the question I want most answered. You can have ip based virtual hosting or name based virtual hosting. The name based virtual hosting seems obvious (I think), that you can have www.sub.domain.com and then www.domain.com appear as two completely different websites, but: Question 4: How does ip based virtual hosting allow a user to request one virtual domain over another?

In the above question, I'm really ignorant about how requests from users is intepreted and/or translated into selecting the different virtual hosts.

Thanks in advance for your attention. Sorry about dumping this huge block of text! (And Merry Christmas and Happy New Year!)
Back to top
View user's profile Send private message
ZHQ
n00b
n00b


Joined: 31 Dec 2009
Posts: 59
Location: Here

PostPosted: Mon Dec 27, 2010 5:25 am    Post subject: Reply with quote

I found this almost immediately after I finished typing this post. Oops.

http://httpd.apache.org/docs/2.2/vhosts/details.html

:oops:
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