python - nginx为什么不能反代图片?
问题描述
我的nginx配置
location ^~ /images/ {alias /home/honmaple/storage/images/;expires 1d; } location ~* ^/admin/(.*)/static/ {alias /home/honmaple/.virtualenvs/blog/lib/python3.4/site-packages/flask_admin/static/;access_log off;expires 1d; } location ~ ^/(api|admin)/ {proxy_pass http://127.0.0.1:8001;proxy_redirect off;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location / {return 403; }
图片路径类似这样 xxx.com/images/admin/thumb/2017/03/148941736894194.png
但是直接访问url会变成xxx.com/images/admin/thumb/2017/03/148941736894194.png/,多了一个斜杠,并且报错404, 查看日志,发现是这样
2017/03/14 00:26:05 [error] 2288#2288: *15061 '/home/honmaple/storage/images/admin/thumb/2017/03/148941736894194.png/index.html' is not found (2: No such file or directory), client: 1.1.1.1, server: xxx.com, request: 'GET /images/admin/thumb/2017/03/148941736894194.png/ HTTP/1.1', host: 'xxx.com'
请教一下这是哪里的配置有问题
问题解答
回答1:你的这里写错了吧,location ^~ /images/ 不应该是~ ^吗
相关文章:
1. MYSQL新建用户设置可以远程访问的问题2. python - 求一个在def中可以实现调用本def满足特定条件continue效果的方法(标题说不太清楚,请见题内描述)3. java - mybatis怎么实现在数据库中有就修改,没有就添加4. $fields = $values = [];这条代码一直定义不了,一直报错,老师的源码也是被报错的,执行不了,请问该怎么解决这个问题5. node.js - nodejs和前端JavaScript 字符串处理结果不一样是什么原因?6. 各位谁知道这个CSS时候哪里出错了???7. mysql - 我的myeclipse一直连显示数据库连接失败,不知道为什么8. mysql 5.7单表300万数据,性能严重下降,如何破?9. mysql 为何insert的时候会有lock wait timeout 异常10. mysql同步数据到elasticsearch用什么工具?
![$fields = $values = [];这条代码一直定义不了,一直报错,老师的源码也是被报错的,执行不了,请问该怎么解决这个问题](http://www.haobala.com/attached/image/news/202205/093622cb60.png)