3

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?

2
  • 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, 2011 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. Jun 29, 2011 at 19:49

1 Answer 1

2

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
5
  • 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. Jun 29, 2011 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, 2011 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. Jun 29, 2011 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, 2011 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. Jun 30, 2011 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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