Setting up a development environment with apache-2.2.6

I recently bought a new laptop as my new development box. A nice 17″ screen with 1920*1200. So now I was to setup a PHP development environment for all the projects I’m working on. I downloaded Apache 2.2.6, PHP 5.2.4 and MySQL 5.0.45. I compiled and installed them and finally added a few virtual hosts. None of the vhosts worked. They all gave me

"client denied by server configuration: ..."

I had missed that apache now ships with a slightly different configuration for the / directory to

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

The Order deny,allow and Deny from all makes the virtual hosts inaccessible by default. When I googled it I saw many forum and blog posts asking about this issue.

To fix it you can either remove/change the lines. But that is probably not a good idea. Better is to explicitly specify which directories that apache are allowed to serve. So for me and my project setup it was as simple as adding a new directory directive opening up my www directories for all the projects.

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory "/home/myusername/Projects/*/www">
    Order deny,allow
    Allow from all
</Directory>

I hope this short explanation helps a few people looking for a solution to the problem.

PHP

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Leave Comment

(required)

(required)