开发者社区 问答 正文

nginx location路径配置:配置报错 

问题如下:
用户访问路径http://xx.com/a/b/c/x.jpg
root目录有/e/f
x.jpg文件物理地址是 /e/f/x.jpg
我该如何配置这个location呢?

展开
收起
kun坤 2020-06-02 17:29:39 527 分享 版权
1 条回答
写回答
取消 提交回答
  • 找到解决方法。 原来alias设置虚拟目录就可以了。
            location  /a/ {             alias F:/soft/;

    allow all;

                location ~ .(jpg|jpeg|gif|png|ico)$ {

                    access_log  off;

                    expires     33d;

                } 

            }

    2020-06-02 17:29:45
    赞同 展开评论