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. 文件服务器 - Python服务器之间文件同步如何实现?2. pdo 写入到数据库的内容为中文的时候写入乱码3. PHP类封装的插入数据,总是插入不成功,返回false;4. 网页爬虫 - python+requests 网页重定向求解5. 如何使用mysql查询每个用户一次操作时记录的值6. 管理员编辑,这么写页面没有反应是怎么回事,我哪里弄错了?7. javascript - vue1.0在微信浏览器的兼容性?8. mysql 时间类型 字段(精确到时分秒) 怎么比较?9. javascript - onfocus="this.type=’password’",为什么不直接用type=’password’10. python3.x - 我把3.6的卸载了,也重启了,但是在cmd用python -V指令查看版本时,还是提示下图的python3.6