Apache Virtual Name-Based Hosting and Default Site
Good afternoon!
I've searched through the LQ.org archives and though I have found threads detailing similar problems, I haven't found a satisfactory answer to my current quandry. I have two domains hosted off of one IP address (1.2.3.4), and httpd -S reports that the configuration file is successful. One domain is working just fine, as it always has, but the second virtual host isn't ever displayed -- just the first (or "default") one. Code:
NameVirtualHost 1.2.3.4:80 Results of httpd -S: Code:
VirtualHost configuration: -- Poetics |
Try substituting the IP to a * in your VirtualHost containers.
Example: <VirtualHost *:80> ... ... ... </VirtualHost> I had a similar problem in the past and setting up like this resolved it. |
Will that affect the fact that I have another website hosted on 1.2.3.5? I have the two aforementioned virtual hosts and another using IP-based hosting (which has never had an issue). I'll give that a try and report back. Thanks for the suggestions!
Edit: No, it killed my IP-based host with it, and still didn't allow me to get to seconddomain.com either. |
Aha! Discovery at last. When one types in www.domain.com Apache recognizes it as a seperate entity than just domain.com -- I was trying www.seconddomain.com and it wasn't working. Now that I've made a second entry for both firstdomain.com and seconddomain.com for www. it works beautifully.
Odd that no howto I've ever found had mentioned this! |
Glad it worked out...
Here's another suggestion: add the ServerAlias directive to your virtualhost container for the domains rather than creating a whole new virtualhost. Code:
#Domain 1 Happy web-serving! |
All times are GMT -5. The time now is 06:01 AM. |