Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Below is my httpd-vhosts.conf file for reference on my Windows 7 machine running xampp 1.7.4:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot C:/xampp/htdocs
    ServerName localhost
    ServerAlias localhost

    <Directory "C:/xampp/htdocs">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@new_site
    DocumentRoot C:/xampp/htdocs/new_site
    ServerName new_site
    ServerAlias new_site

    <Directory "C:/xampp/htdocs/new_site">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

I cannot even being to guess why but running https on any localhost directory (even https://localhost/new_site works fine) but running https://new_site generates a 404 error.

I am aware that port 443 is typically used in https redirects but adding this to the virtualhost configuration file causes apache to stop running altogether. Also, port 443 is never defined for localhost in the same file so it makes me think it is not necessary.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Apache is happy with this config, your DNS however... Not so much. You need to tell your computer that you aren't only localhost but also new_site.

You can do this by editing your hosts-file, located at %systemroot%\system32\drivers\etc\hosts. Add this line:

127.0.0.1 new_site

Or add a new A-record to your DNS if you are running one.

In order for https to work you need to add your site to ssl.conf or httpd-ssl.conf, your localhost should be defined here also.

share|improve this answer
    
did that. Http://new_site works fine - new_site gives a 404 –  JM4 Apr 12 '11 at 22:02
    
Edited my post. Misinterpreted your first post, sorry ;-) –  Bart De Vos Apr 12 '11 at 22:07
    
thanks for your help. Adding to httpd-ssl.conf was the issue at hand. Appreciate it! –  JM4 Apr 12 '11 at 22:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.