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. java - Spring MVC怎么實現提交表單后跳轉?2. javascript - table列過多,有什么插件可以提供列排序和選擇顯示列的功能3. java - input file類型上傳了一個文件,想計算一下上傳文件的大小?4. python - 為什么正常輸出中文沒有亂碼,zip函數之后出現中文編程unicode編碼的問題,我是遍歷輸出的啊。5. javascript - windows下如何使用babel,遇到了困惑6. html - vue項目中用到了elementUI問題7. JavaScript事件8. showpassword里的this 是什么意思?代表哪個元素9. 對mysql某個字段監控的功能10. javascript - js中向下取整
