Working on using nginx to serve images.
static.foobar.com/UUID.jpg url will actually serve as a pointer to a PHP script which determines if you have permission to view that image (and if so, serve it via PHP/X-Accel-Redirect).
DNS/nginx are setup correctly on the subdomain, but I'm getting a 404. Here's my current server block:
server {
listen x.x.x.x:80;
server_name static.foobar.com;
location ~ \.(gif|jpg|png) {
internal;
rewrite "^/([a-f0-9]{8})-([a-f0-9]{4})-4([a-f0-9]{3})-([a-f0-9]{4})-([a-f0-9]{12}).(gif|jpg|png)" /dir/photo.php?uuid=$1-$2-4$3-$4-$5 last;
}
}
I'm wondering if the presence of gif|jpg|png is forcing nginx to set the mime-type as an image, which is causing a conflict when I send the session to a PHP file. Could that be the issue? What else can I do to help debug this or does anyone have any pointers please?
Thanks kindly
Update: in the end, the problem was that on my server, nginx php-fpm is not supported with cpanel, so my nginx config wasn't able to run php at all. I was hoping to offload serving of these files via nginx but will unfortunately have to go back to using apache. Thank you all for your time and help.
server
block?/dir/photo.php
is the one to markinternal
- if appropriate.