[英]Serve pdf file by location in nginx
How I can to serve the file: 如何提供文件:
'/webapps/app/static/downloads/privacy_policy.pdf'
by address: 按地址:
https://my.site.net/privacy/
I try to use location in my nginx, but this not work: 我尝试在nginx中使用位置,但这不起作用:
location /privacy/ {
alias /webapps/app/static/downloads/privacy_policy.pdf;
}
I found solution. 我找到了解决方案。 I move the pdf file in separate directory "privacy". 我将pdf文件移动到单独的目录“ privacy”中。 I set the directory as alias and set I set pdf document as an index file: 我将目录设置为别名,并将pdf文档设置为索引文件:
location /privacy/ {
alias /webapps/app/static/downloads/privacy/;
index privacy_policy.pdf;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.