Question

I have an apache server installed on my portable windows 7 machine using xampp as an interface. I've been working with a few people on an irc channel but must soon go to bed and replies are getting slower.

I have the following code added to my httpd.conf file:

#virtual servers
#Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
    ServerName localhost.MEALS
    DocumentRoot C:\xampp\htdocs\MEALS
    DirectoryIndex index.php
</VirtualHost>
<VirtualHost *:80>
    ServerName localhost.HA
    DocumentRoot C:\xampp\htdocs\Hackers
    DirectoryIndex index.php
</VirtualHost>
<VirtualHost *:80>
    ServerName localhost.WIK
    DocumentRoot C:\xampp\htdocs\WhoIKnow
    DirectoryIndex index.php
</VirtualHost>
<VirtualHost *:80>
    ServerName localhost.TUS
    DocumentRoot C:\xampp\htdocs\Unity
    DirectoryIndex index.php
</VirtualHost>
<VirtualHost *:80>
    ServerName localhost.PHP
    DocumentRoot C:\xampp\htdocs\phpMyAdmin
    DirectoryIndex index.php
</VirtualHost>

And I have the following configuration:

Setting environment for using XAMPP for Windows.
John@ASSIMILATER C:\xampp
# httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443          localhost (C:/xampp/apache/conf/extra/httpd-ssl.conf:80)
*:80                   is a NameVirtualHost
         default server localhost.MEALS (C:/xampp/apache/to which there was conf/httpd.conf:512)
         port 80 namevhost localhost.MEALS (C:/xampp/apache/conf/httpd.conf:512)
         port 80 namevhost localhost.HA (C:/xampp/apache/conf/httpd.conf:516)
         port 80 namevhost localhost.WIK (C:/xampp/apache/conf/httpd.conf:520)
         port 80 namevhost localhost.TUS (C:/xampp/apache/conf/httpd.conf:524)
         port 80 namevhost localhost.PHP (C:/xampp/apache/conf/httpd.conf:528)
Syntax OK

John@ASSIMILATER C:\xampp
#

However when I try to access localhost.PHP in my web browser it tells me the server is not found. I was instructed that I need to resolve the host names on my machine. I was directed to a few irc channels (dns and windows) to which there was no reply. I searched google and ran across this site: http://technet.microsoft.com/en-us/library/bb727005.aspx#EEAA. I'm not quite sure what I'm reading and as near as I can tell it doesn't quite give me a clear instruction on where to resolve the host name or a file to edit.

Also currently the default server is the top virtual server in the code. I would like to call localhost and show a simple html page I created which is in "htdocs/index.html" which will navigate to the other servers (links pointing to "localhost.PHP" etc). is there a way to have the default server remain "localhost" which points to "htdocs/index.html" while maintaining the other virtual servers, or will I have to create another virtual server and make that the default?

Any and all help appreciated.

edit: I had someone help me find the HOSTS file on my machine but am unable to edit it. I turned off all antivirus features, turned off spybot (UAC was always off and I always run with administrator privileges) specifically right clicked on np++ editpadlite and windows notepad and was only able to edit in notepad, but was required to save the file with a different name.

Was it helpful?

Solution

You have to explicitly run Notepad as an administrator (regardless of UAC settings) and when you go to save, make sure you select 'all files' rather than the default *.txt.

I found the same thing when I tried to edit the hosts file on W7, but it seems that just being an administrator on the machine isn't quite the same as explicitly running the program as an administrator.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top