djangowordpressapache2passenger

apache2 Allow access to subdirectory


I am currently running a Django site on Dreamhost using Passenger. I would like to run a Wordpress blog in the 'public' directory that currently holds my static files (which is where I assume it should live). Since Django currently owns all of /*, I was told I would need to add a Location entry to the httpd.conf of my apache2 server. I tried both Location and Directory and could not get them to work. The code snippet below is basically what I typed in a bunch of different ways.

<Directory /home/user/domain/public/blog/>
Order allow,deny
allow from all
</Directory>

I also tried adding AllowOverride All to try and catch the htaccess file in the blog folder but no dice. I am extremely new to messing with apache (first time), can anyone point me in the right direction to get /blog/ to show the wordpress site and not a 404 page.


Solution

  • The key to my problem was identifying how to override Passenger, which is what is running the Django app. Access your httpd.conf file. Within the main Virtualhost section (the one that defines your domain and how the public folder is handled) place this code to override Passenger and Django's grip on the /* directory.

    Alias /blog /home/user/domain/public/blog
    
    <Directory /home/user/domain/public/blog>
    PassengerEnabled off
    AllowOverride all
    Order Deny,Allow
    Allow from all
    </Directory>
    

    Adding PassengerEnabled off takes care of Passenger and allows the Directory to be served outside of the Django app. I don't think AllowOverride or Allow from all does much of anything but I left it in just to be safe. Works perfectly now.