Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have setup a virtualhost for MacOSX Apache installation.

These are my steps:

  • edit /private/etc/apache2/httpd.conf removing comment from:

    Include /private/etc/apache2/extra/httpd-vhosts.conf 
    
  • edit /private/etc/apache2/extra/httpd-vhosts.conf, added:

<VirtualHost *:80>
ServerName test.local
DocumentRoot "/Users/myusername/Sites/Test/public"
<Directory "/Users/myusername/Sites/Test/public">
Options Indexes FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
  • edit /private/etc/hosts added

    127.0.0.1 test.local
    
  • Restart Apache

But the VirtualHost does not work. To further isolate the problem, I check the same configuration with MAMP and the virtual host worked right, so the configuration files should be fine.

What can be wrong?

share|improve this question
    
I can't spot any obvious mistakes in your config file, but you might like to try VirtualHostX for Mac OSX. It greatly simplifies creating Apache virtual hosts. –  Nick Jun 29 '11 at 16:40
    
@Nick Excellent recommendation, but I'm trying to learn the thing from the ground up so I prefer for now stick to manual editing. I will anyway check the app for the future. –  David Casillas Jun 29 '11 at 19:49
add comment

1 Answer

Maybe your config has wrong IP?

127.0.0.7 test.local

This one should work just fine:

127.0.0.1 test.local

Additionally you may have incorrect <VirtualHost> directives formatting (unless this is happened when you inserted text here). Instead of

Options Indexes FollowSymLinks 
Includes AllowOverride All

should be

Options Indexes FollowSymLinks Includes
AllowOverride All
share|improve this answer
    
Excuse me, I have corrected the errors in the post. My configuration were correct, but I add some mistakes when formating the text of the post. –  David Casillas Jun 29 '11 at 16:21
    
@David This config looks absolutely fine to me. When you say "does not work" -- what do you mean exactly/how it does not work? –  LazyOne Jun 29 '11 at 16:42
    
I'll point the browser to test.local and he cannot find the address. I have created the folders Test/public and a test index.html file inside public. May be a permisions issue?, although as I have pointed the same configuration worked under MAMP instalation. –  David Casillas Jun 29 '11 at 19:44
    
@David I'm not a Mac user so cannot really advice much here. Config is fine .. what error log say, anything at all? –  LazyOne Jun 29 '11 at 20:18
    
There should be some other error becouse localhost was also falling to load. I reset the conf files to original state and localhost now works. I have a diferent problem now, but I will start a new post. Thanks. –  David Casillas Jun 30 '11 at 8:04
add comment

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.