i have a nginx configuration something like this,
server {
server_name my.domain.com;
listen 80;
root /path/to/http/root;
include /path/to/proxy.common.conf;
location ~ ^/foo-(.+)$ {
alias /path/to/static/file/$1;
}
location / {
try_files $uri $uri/ =404;
proxy_pass http://127.0.0.1:8000/;
}
}
i'm unable to access the files with location /foo-something.xls, it always returns 404 not found...
i also tried with .xlsx, .doc, and .docx but it also shows not found...
if i access file like .js, .css, .png, .xls1, .doc1, etc, it behaves normally...
the error log shows the location with regex did not match, and tried to look at the root location...
i also tested the location with
location = /foo-test1.xls
location ^~ /foo-test2.xls
and alias to a file, and it returns the file content...
am i missing something with my configuration?
i just found this problem when developing a report generator module on my company's framework...
i also tried to read at both nginx source and pcre source, but i can't find any string that related to those extensions...
/foo-file.xls1
but nut/foo-file.xls
? Are the permissions the same (although that should give a 403).ls
, it does find it then?