I am trying to get Nginx to rewrite URL space ./data/(.+).png to serveImage.php?guid=$1
server {
server_name my.server;
listen 80;
listen 127.0.0.1:80;
root /var/www/my.server;
index index.html;
location / {
try_files $uri $uri/ index.html;
rewrite ^/data/(.+).png serveImage.php?guid=$1 last;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
}
What am I doing wrong? serveImage.php
does exist in the document root.