現在有域名www.services.com, 對應的服務器上部署了三個服務ServiceA, ServiceB, ServiceC,每個服務的訪問方法為訪問對應路徑的index.html文件即可, 如ServiceA服務的前端路徑為Path/to/A, ServiceB服務的前端路徑為pATh/tO/B然后我想要實現通過http://www.services.com/ServiceA 來訪問Path/to/A/index.html, 于是我嘗試了這樣子的配置:http { listen 80; server_name www.services.com; # nginx默認配置
location / { root html; index index.html index.htm
} # ServiceA配置
locaton ^~ /ServiceA { root Path/to/A
index.index.html index.htm
}
}而最后實際上會請求訪問到/Path/to/A/ServiceA/或是/usr/share/nginx/html/ServiceA/, 于是返回404報錯.請問為什么會出現這樣的路由規則? 如何實現期望效果?
關于nginx使用路徑重定向至服務的問題?
慕田峪4524236
2018-06-13 13:01:02