看板 MIS 關於我們 聯絡資訊
同台電腦配置多個伺服器 類似這樣 location /server3 { proxy_pass http://127.0.0.1:7000/; } location /server2 { proxy_pass http://127.0.0.1:8000/; } location / { proxy_pass http://127.0.0.1:9000/; } 如果打開 server3 http://localhost/server3 其中有引入靜態資源路徑是 ./index.css 找的會是根伺服器 localhost / 的靜態資源 要用 localhost:7000/index.css 才能正確讀到 請問我要怎麼配置 才能即使 根伺服器 和 server3 都有引用 ./index.css 也能正確分別引用 使用 http://localhost/server3 能正確讀取到 ./index.css 而不是404或其他伺服器的 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.243.150.14 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/MIS/M.1678013600.A.8A6.html ※ 編輯: surimodo (111.243.150.14 臺灣), 03/05/2023 18:54:58
tomsawyer: rewrite 03/05 19:32
tomsawyer: rewrite ^/server3/(.*) /$1 break; 試試 03/05 19:35
surimodo: 後來小改伺服器專案 url加前綴區分 03/06 08:01