Page 1 of 1

Setting Virtual Host(s) on Apache can't be done!

Posted: Fri Sep 02, 2005 6:53 am
by webvand
I’ve tried a lot to set up and use ‘Virtual Host’ on my Apache Server (Ms-Win) based on Localhost. but can’t solve my problem with that.
What I could do was just set IP-Based virtual hosts and can’t play with Name-Based ones - on local host-. any doable idea? Or even particular tutorial? I can’t find out what’s wrong with that!
Here is the code witch I use in my httpd.conf file for virtual hosts (It works):

Code: Select all

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
ServerAdmin local@local
DocumentRoot "c:/apachefriends/xampp/htdocs/"
ServerName this-parameter-isnot-working
</VirtualHost>
---
But what's wrong with this one? (something.com is not available!)

Code: Select all

NameVirtualHost something.com:80

<VirtualHost something.com:80>
ServerAdmin local@local
DocumentRoot "c:/apachefriends/xampp/htdocs/"
ServerName this-parameter-isnot-working
</VirtualHost>
Is there something to set about DNS settings on windows?

Any idea will appreciate...
:idea:

Posted: Fri Sep 02, 2005 7:16 am
by timvw
Here is an example of my hosts file (C:/windows/system32/drivers/etc/hosts)

Code: Select all

127.0.0.1       localhost test
Here is my httpd.conf virtual hosts section

Code: Select all

NameVirtualhost *:80

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot "F:/websites/localhost"
  <Directory "F:/websites/localhost">
    AllowOverride All
    Options All
  </Directory>
</Virtualhost>

<VirtualHost *:80>
  ServerName test
  DocumentRoot "F:/websites/test/pubwww"
  <Directory "F:/websites/test">
    AllowOverride All
    Options All
  </Directory>
</Virtualhost>

Posted: Fri Sep 02, 2005 9:23 am
by webvand
Wow, got it...
I didn't know about possibility to add two words/names in host file separated with an space char
Thank you so much for your helpful reply.