Can't combine alias with fastcgi_cache in Nginx
This works:
location ~ ^/special/(.+\.php)$ {
alias /var/special/$1;
try_files "" =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000; # php-fpm socket
}
But this doesn't:
location ~ ^/special/(.+\.php)$ {
alias /var/special/$1;
try_files "" =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000; # php-fpm socket
fastcgi_cache mycache;
}
If I try to go to the URL "/special/index.php" I get a "File not found."
text in the browser, which I assume comes from php-fpm or PHP. And I get
this error in the Nginx log:
FastCGI sent in stderr: "Primary script unknown", client: 202.179.27.65,
server: myserver.org, request: "GET /special/index.php HTTP/1.1", host:
"myserver.org"
Any idea why adding fastcgi_cache breaks this?
Note that fastcgi_cache works fine when I use a location that doesn't use
an alias.
No comments:
Post a Comment