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, 查看日志,發(fā)現(xiàn)是這樣
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/ 不應(yīng)該是~ ^嗎
相關(guān)文章:
1. docker-compose中volumes的問題2. 我在centos容器里安裝docker,也就是在容器里安裝容器,報錯了?3. 在windows下安裝docker Toolbox 啟動Docker Quickstart Terminal 失敗!4. docker-machine添加一個已有的docker主機問題5. golang - 用IDE看docker源碼時的小問題6. docker不顯示端口映射呢?7. javascript - 連續(xù)點擊觸發(fā)mouseleave事件8. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””9. docker內(nèi)創(chuàng)建jenkins訪問另一個容器下的服務(wù)器問題10. mac里的docker如何命令行開啟呢?

網(wǎng)公網(wǎng)安備