我试图让 Nginx 将 URL 空间 ./data/(.+).png 重写为 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;
}
}
我究竟做错了什么?serveImage.php
确实存在于文档根目录中。