鍍金池/ 問(wèn)答/Linux/ nginx這樣配置怎么沒(méi)有作用?

nginx這樣配置怎么沒(méi)有作用?

訪問(wèn)80端口,圖片的路徑怎么沒(méi)有映射到82端口那里,這配置哪里錯(cuò)了?

http {
    client_max_body_size    10m;
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
        
        location /publish {
             proxy_pass http://localhost:82/Publish/;
        }
        
        location / {
             proxy_pass http://localhost:81;
        }
    }
}

nginx access.log 日志是這樣的

127.0.0.1 - - [03/Feb/2018:09:52:26 +0800] "GET /publish/focus/20180123/1554319687.jpg HTTP/1.1" 400 334 "http://localhost/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
回答
編輯回答
互擼娃

publish 少了斜杠

location /publish/ {
     proxy_pass http://localhost:82/publish/;
}
2018年5月14日 19:28
編輯回答
熊出沒(méi)

好像匹配規(guī)則的問(wèn)題,location / 的規(guī)則把 location /publish 覆蓋了吧。。。

2018年4月17日 11:18