|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Virtual Hosting - seems simple?
Okay. I have searched this forum but have had no luck finding answers.
Allow me to introduce my setup as this is pretty complicated. I have a "static" IP (24.160.xxx.xxx) that is assigned to my cable modem. I am using a Linksys router to share the connection and have a redhat 7.1 client running 1.3.20 with the assigned IP of 192.168.1.101. I have configured the router/firewall to forward ALL port 80 requests to the redhat box. I own a domain name that I am using mydomain.com to manage. I have enabled IP forwarding, pointing my domain (lydiascatering.com) to the IP (24.160.xxx.xxx). I have also tried to configure Virtual Hosting in apache and the problem I am having is that EVERY request is using the virtual host directive's docroot. I only want the domain name request to use the docroot of the virtual host directive. here is the directive snippet. ... NameVirtualHost 192.168.1.101 ... <VirtualHost 192.168.1.101> ServerName www.lydiascatering.com ServerAlias lydiascatering.com cater ServerAdmin webmaster@lydiascatering.com ErrorLog logs/lydiascatering.com-error_log CustomLog logs/lydiascatering.com-access_log common DocumentRoot /home/lydia/www </VirtualHost> I have a different docroot defined outside of the VirtualHost section. But am not able to access that. So all 192.168.1.101, 24.160.xxx.xxx, and www.lydiascatering.com are using the same docroot, and I only want the domain request to. Does this make sense? Can anyone help. I would be more than willing to work offline with someone more knowledgeable. Email me at kingjr3@yahoo.com Thanks in advance. Please help. My goal is to host many domains from my house, and I first need to get ONE working correctly. |
|
#2
|
|||
|
|||
|
>> I am having is that EVERY request is using the virtual host directive's docroot
How many <VirtualHost> block do you currently have? What are they? Note, if you have just one, then that overrides what you defined in global context, and is really redundant in doing so because you don't have a vhost, it really is your default host. >> NameVirtualHost 192.168.1.101 It would make your life easier if you just use NameVirtualHost * and <VirtualHost *> to begin with. |
|
#3
|
|||
|
|||
|
one
I only have one Virtual host block. I will have multiple in the future.
I did change it to *. The thing is I want the domain based request to use the vhost block and the IP based reqests to use the default. Is this even possible? or is there a way I can differentiate with another vhost block ? what will happen if the request doesn't match any of the servernames? I did read that if the client does not pass the host information (via the host header) then the first virtualhost block will ALWAYS be used. I am guessing this is the case because this is likely since I am using the router to direct the request and a domain management service to route the request to my IP. |
|
#4
|
|||
|
|||
|
>> I want the domain based request to use the vhost block and the IP based reqests to use the default
You don't appear to have more than 1 IP, therefore you can't use IP-based. As far ad Name-based, the 1st <VirtualHost> has highest priority. >> I will have multiple in the future Then configure <VirtualHost> when you have them. Currently you just can't. |
|
#5
|
|||
|
|||
|
thanks
Makes sense.
All that I did was add <Virtualhost *> DocumentRoot /some/other/docroot </Virtualhost> before my other vhost section. and this served as my "default". Thanks again Freebsd. |
|
#6
|
|||
|
|||
|
>> before my other vhost section
Like I said, the very 1st <VirtualHost> is the default and has higher priority. When adding additional <VirtualHost *>, at the minimum you need to specify a DocumentRoot and ServerName. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Virtual Hosting - seems simple? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|