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

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
webvand
Forum Newbie
Posts: 4
Joined: Fri Sep 02, 2005 1:18 am

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

Post 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:
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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>
webvand
Forum Newbie
Posts: 4
Joined: Fri Sep 02, 2005 1:18 am

Post 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.
Post Reply