views:

242

answers:

4

I have recently installed Apache 1.3.41 on a Windows Vista machine. I have not changed the default settings in httpd.conf aprart from trying to setup virtual hosts, as follows:

Added some host names in the hosts file:

127.0.0.1    localhost
#::1         localhost
127.0.0.1    mysite
127.0.0.1    mydomain

I made the following folders in C:/Users/Moukasp/

C:/Users/Moukasp/Apache
C:/Users/Moukasp/django/mysite

Then added some simple html pages in each of those folder and the c:/Users/Moukasp/pictures folder and, finally, I added the following settings at the end of httpd.conf:

NameVirtualHost 127.0.0.1

<VirtualHost localhost>
# ServerAdmin [email protected]
DocumentRoot "C:/Users/Moukasp/Apache"
ServerName localhost
Alias "/pics" "c:/users/moukasp/pictures" 
Alias "/ap"  "C:/Program Files/Apache Group/Apache/htdocs"
Alias "/dj" "C:/Users/Moukasp/django/mysite"  
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost mysite> 
# ServerAdmin [email protected]
DocumentRoot "C:/Users/Moukasp/django/mysite"
ServerName mysite
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost mydomain>
# ServerAdmin [email protected]
DocumentRoot "C:/Users/Moukasp/django/mysite"
ServerName mydomain
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

So, urls

http://localhost 
http://localhost/pics
http://localhost/ap
http://localhost/dj
http://mydomain

work fine. But I there's no response from http://mysite which, as can be seen from the settings, serves from the same folder as http://mydomain. I have tried various names but no response. The hosts file is being read every time I start the Apache server. I even removed the mydomain server from the hosts file and the httpd.conf lest there's a limitation in the number of virtual hosts, but no luck.

Any help would be greatly appreciated, els I go mad! It is true, I have being trying this after complete failure to make Apache work with mod_python for django! I just hoped that a step at a time would lead to some success!

A: 

Try:

NameVirtualHost 127.0.0.1:80

In your httpd.conf. My config file includes a comment stating a port-specifier should be used.

Aiden Bell
A: 

The VirtualHost and NameVirtualHost directives should have IP addresses and ports:

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80> 
# ServerAdmin [email protected]
DocumentRoot "C:/Users/Moukasp/django/mysite"
ServerName mysite
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
Matt Bridges
A: 

Tried NameVirtualHost 127.0.0.1:80 but it doesn't make any difference! The only servers that work are localhost and mydomain.
I wonder whether I need to do something more than just declare the server name of each virtual host in the hosts file.

A: 

Try adding a port declaration to the hosts. For example:

<VirtualHost mydomain:80>
DocumentRoot "C:/Users/Moukasp/django/mysite"
ServerName mydomain
</VirtualHost>
MiffTheFox
Done that, no luck! :(