I'm using nginx as a reverse proxy for a Drupal 7 site running on Apache2.
When I try to view a thumbnail I get the Drupal 404 page saying that the location is not found.
I have implemented the location rules to rewrite requests to the thumbnail to index.php and the error message includes this rewritten request.
These are my nginx location blocks:
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
location ~ ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
}
# Try to serve files with Nginx if possible
location / {
try_files $uri @proxy;
}
# Pass on php to Apache
location ~* \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
proxy_pass http://127.0.0.1:8000;
include /etc/nginx/proxy_params;
}
location @proxy {
proxy_pass http://127.0.0.1:8000;
include /etc/nginx/proxy_params;
}
The url of a thumbnail looks like this:
http://example.com/sites/default/files/styles/thumbnail/public/pictures/picture-1-1437996028.jpg?itok=19uLP_Ax
The error message displayed is:
The requested page "/index.php?q=sites/default/files/styles/thumbnail/public/pictures/picture-1-1437996028.jpg&itok=19uLP_Ax" could not be found.
I have tried setting the flag to allow insecure content generation (without a token) to test with. Obviously I've removed that flag.