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. mysql - 把一个表中的数据count更新到另一个表里?3. 请教使用PDO连接MSSQL数据库插入是乱码问题?4. mysql - 分库分表、分区、读写分离 这些都是用在什么场景下 ,会带来哪些效率或者其他方面的好处5. python - 数据与循环次数对应不上6. python - 爬虫模拟登录后,爬取csdn后台文章列表遇到的问题7. 视频文件不能播放,怎么办?8. 黑客 - Python模块安全权限9. Python爬虫如何爬取span和span中间的内容并分别存入字典里?10. node.js - nodejs开发中常用的连接mysql的库
