python - nginx為什么不能反代圖片?
問(wèn)題描述
我的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; }
圖片路徑類(lèi)似這樣 xxx.com/images/admin/thumb/2017/03/148941736894194.png
但是直接訪問(wèn)url會(huì)變成xxx.com/images/admin/thumb/2017/03/148941736894194.png/,多了一個(gè)斜杠,并且報(bào)錯(cuò)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'
請(qǐng)教一下這是哪里的配置有問(wèn)題
問(wèn)題解答
回答1:你的這里寫(xiě)錯(cuò)了吧,location ^~ /images/ 不應(yīng)該是~ ^嗎
相關(guān)文章:
1. java - spring boot 如何打包成asp.net core 那種獨(dú)立應(yīng)用?2. java - 在用戶不登錄的情況下,用戶如何添加保存到購(gòu)物車(chē)?3. javascript - webpack 分割加載代碼后,react 界面不更新4. 安全性測(cè)試 - nodejs中如何防m(xù)ySQL注入5. html - eclipse 標(biāo)簽錯(cuò)誤6. javascript - nginx反向代理靜態(tài)資源403錯(cuò)誤?7. python文檔怎么查看?8. javascript - 關(guān)于apply()與call()的問(wèn)題9. datetime - Python如何獲取當(dāng)前時(shí)間10. android - SwipeRefreshLayout5.0以下不兼容
