作者:
surimodo (好吃棉花糖)
2023-03-05 18:53:18同台電腦配置多個伺服器
類似這樣
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或其他伺服器的