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

It seems that the most basic virtual host does not work under apache 2.2 :

# httpd.conf
Listen 80
....
Include /private/etc/apache2/extra/httpd-vhosts.conf

the httpd-vhosts :

# httpd-vhosts.conf
NameVirtualHost *:80

<VirtualHost *:80>
    ServerName project.dev
    ServerAlias lol.project.dev
    ServerAlias shootmania.project.dev

    DirectoryIndex "app.php"
    DocumentRoot "/Users/tb/workspace/project/web"
    <Directory "/Users/tb/workspace/project/web">
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>

    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>

Here's what output apachectl :

apachectl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
         default server project.dev (/private/etc/apache2/extra/httpd-vhosts.conf:21)
         port 80 namevhost project.dev (/private/etc/apache2/extra/httpd-vhosts.conf:21)
         port 80 namevhost pow (/private/etc/apache2/other/zzz_pow.conf:1)
Syntax OK

In my pow configuration :

<VirtualHost *:80> 
  ServerName pow 
  ServerAlias *.dev 
  ServerAlias *.xip.io 
  ProxyPass / http://localhost:20559/ 
  ProxyPassReverse / http://localhost:20559/ 
  ProxyPreserveHost On 
</VirtualHost>

Accessing to localhost defaults on the project website, but accessing to http://project.dev gives a 404 Not found

Thanks for your help

share|improve this question
1  
Check your error log. –  Michael Hampton Mar 9 at 19:03
    
The error log is empty for project.dev but for the global one : [Sun Mar 09 19:40:24 2014] [warn] NameVirtualHost *:80 has no VirtualHosts –  Tristan Mar 9 at 19:03
1  
@Tristan Is that during the current service start? That shouldn't be possible given the apachectl -S output. –  Shane Madden Mar 9 at 19:07
    
Yes @ShaneMadden its during service start –  Tristan Mar 9 at 19:09
    
@Tristan What's the pow vhost doing? And from your access logs, are the requests to localhost being served by the project.dev virtual host? –  Shane Madden Mar 9 at 19:12

2 Answers 2

up vote 1 down vote accepted

I uninstalled pow, and removed rules in firewall that pow installs, and it works like a charm. Pow was the responsible for that :/

share|improve this answer

Your pow vhost configuration defines "ServerAlias *.dev" which overlaps your other VirtualHosts.

share|improve this answer
    
It always double-lists the one that's being used as default - that should be normal :) –  Shane Madden Mar 9 at 19:07
    
Oh yeah, my bad, it does point to the same configuration. –  ETL Mar 9 at 19:09

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.