I have a simple Django application that I am using to test out a new deployment strategy using Nginx, FastCGI (using the latest version of flup at the time of writing) and daemontools.
Basically the problem is if I visit domain.com the main page displays correctly but if I visit domain.com/example/ it still displays the main page. This seems like a problem with FastCGI to me but I'm completely stumped. No matter what page I visit it always displays the main page. No errors, nothing. Its like it always just silently returns the same page no matter what the url.
The nginx error log has absolutely nothing displayed in it at all so that is no help. The project works 100% perfectly using the development server but just fails on the server.
My daemontools run file is as follows:
#!/usr/bin/env bash
source /envs/domain.com/bin/activate
PROJ_DIR=/project
exec envuidgid simon python $PROJ_DIR/manage.py \
runfcgi method=threaded minspare=1 maxspare=2 host=127.0.0.1 \
port=9001 pidfile=$PROJ_DIR/proj.pid daemonize=false
My nginx config:
server {
listen 80;
server_name domain.com;
rewrite ^/(.*) http://www.domain.com/$1 permanent;
}
server {
listen 80;
server_name www.domain.com;
access_log /domain.com/logs/access.log;
error_log /domain.com/logs/error.log;
root /domain.com/public_html;
index index.html;
location / {
try_files $uri @django;
}
location /static {
alias /project/static;
}
location /media {
alias /project/media;
}
location @django {
include /opt/nginx/conf/fastcgi_params;
fastcgi_pass 127.0.0.1:9001;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
}
}
Any help would be very much appreciated :).