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. thinkphp3 count()方法必須加上字段?2. python中return 語句與 分支語句連用問題3. mysql 5個left關(guān)鍵 然后再用搜索條件 幾千條數(shù)據(jù)就會卡,如何解決呢4. python - angular route 與 django urls 沖突怎么解決?5. 這是什么情況???6. 微信內(nèi)網(wǎng)頁上傳圖片問題7. 非root安裝MySQL5.6報錯,求助!!!8. 輸入地址報以下截圖錯誤,怎么辦?9. node.js - nodejs中mysql子查詢返回多行結(jié)果怎么處理?10. mysql - 瞬間流量很高的網(wǎng)站,要頻繁的插入數(shù)據(jù)到數(shù)據(jù)庫,應(yīng)該怎么解決這個問題?
