Question:
Problem creating virtual hosts in apache?
soldier
2008-03-16 04:47:54 UTC
Hi All, I am trying to create virtual hosts on apache on linux box. My httpd-vhosts.conf is as follows:
NameVirtualHost *:80

ServerAdmin admin@site1.com
ServerName www.site1.com
ServerAlias site1.com
DocumentRoot "/nfs/site1/html"

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

ErrorLog logs/site1/error_log
CustomLog logs/site1/access_log common


Similarly, I've another virtual host for site2 whose docroot is "/nfs/site2/html".

I've added the following lines in /etc/hosts file: IP_Address www.site1.com IP_Address www.site2.com Now, If I open browser and type my IP address then it is executing the code in /nfs/site1/html folder. But if I try to access www.site1.com from browser its displaying the message "website cannot be found". So I used www.site1.com:80, still I get the same error message. Can anyone please help me on this.
Thanks,
Mohan
Three answers:
covinher
2008-03-16 18:46:09 UTC
That message in your browser literally means the browser couldn't resolve your hostname to an IP address -- it's not generated by Apache.



'nscd', the name-server caching daemon, might prevent changes from your hosts file from showing up in applications without a restart.



Your virtualhost configuration is correct. You'd probably get better feedback (but different results in this case!) from a command line client or even by telnet'ing to port 80 and issuing a request.
anonymous
2008-03-16 04:59:39 UTC
You either need NameVirtualHost directive, so that the server identifies them by name, or a multiple IP address approach, in which case the AddressVirtualHost is OK. NameVirtualHost is easier to implement, but it does rely on there being a genuine dns record set for each host name. your hosts entries are useless, set UseCononicalName to off.
?
2016-05-30 07:22:11 UTC
the problem you will have is your ISP. upload speeds and bandwidth are not that great on standard accounts. hosting 400 sites on a home server on a residential internet connection would garuntee terrible service should a few of the site become popular.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Loading...