0

I have a solution to run a Django (1.3.1 on Python 2.7) site which is working on an old server. I'm trying to migrate this to a new server but I'm encountering the following error when I try to access the page (which says it's forbidden in the browser):

[Mon Sep 18 06:48:32.394835 2017] [authz_core:error] [pid 24239:tid 140298255943424] [client 86.133.221.44:58348] AH01630: client denied by server configuration: /var/django/sarahcage/fastcgihook.fcgi

My apache config includes this line:

FastCGIExternalServer /var/django/sarahcage/fastcgihook.fcgi -socket /var/django/sarahcage.sock

My apache site config looks like this:

<VirtualHost 46.101.39.249:80>
<Directory "/var/www/sarahcage">
    AllowOverride All
    Require all granted
</Directory>
ServerName newserver.sarahcage.co.uk
DocumentRoot /var/www/sarahcage
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?$ /var/django/sarahcage/fastcgihook.fcgi/$1 [QSA,L]

# Set the whole site to use DJango
<LocationMatch "^/?$">
        SetHandler fastcgi-script
</LocationMatch>

</VirtualHost>

I run up the django deamon like this:

 /var/django/sarahcage/manage.py runfcgi socket=/var/django/sarahcage.sock pidfile=/var/run/sarahcage_fcgi.pid

There's one notable difference between the two servers; The new one is running on Apache/2.4.18 (Ubuntu) whereas the old one is running Apache/2.2.22 (Ubuntu). I've tried to follow the guidelines on upgrading but they don't seem to have helped.

I've checked and double checked permissions between the two machines but I just can't see what I've missed. What might I be doing wrong?

Jon Cage
  • 329

1 Answers1

0

Turns out I had to set the 'Require' statement for the directory that the fastcgi hook was using as well:

<Directory "/var/django">
    AllowOverride all
    Require all granted
</Directory>
Jon Cage
  • 329