I'm relatively new to anything sysadmin/nginx-related, and experimenting with Digital Ocean's VPS.
I have a Django app which I've got running on my domain (on the root) using Gunicorn and Supervisor (to restart the process). I also serve some static files for the Django app. I'd now like to see if I can serve a Wordpress PHP site as well, all on the same server.
Below is my nginx configuration. It works for the Django app and its static files, but Wordpress is weird: the Wordpress admin works fine, but the frontend fails (just renders a blank page). Is there an obvious error?
For what it's worth, these are the URLs I'd like to be using:
example.com/
– Django appexample.com/assets/*
– static files (for Django app)example.com/blog
– Wordpress app
Here's the nginx config:
server {
listen 80;
root /usr/share/nginx/www;
index index.php index.html index.htm;
server_name my.ip.goes.here;
location /assets/ {
alias /opt/foo/assets/;
expires max;
access_log off;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
proxy_ignore_headers "Cache-Control" "Expires" "X-Accel-Expires" "Set-Cookie";
}
location /blog/ {
try_files $uri $uri/ /blog/index.php?q=$uri&$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location / {
proxy_pass my.ip.goes.here:8001;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
What am I missing to make the /blog/
subfolder properly serve the Wordpress instance? The admin (/blog/wp-admin/index.php
) serves correctly and is fully usable.