如何给动态路由配置nginx

比如:
访问 https://host/path/case/:id 的时候
id 可以是任何值。
应该映射到 ttps://host2/static/path/case/code/index.html

起初我是这么配置的

location /path/case/ {
    proxy_pass https://ip/path/case/code/index.html
    ...
}

这样没有用。

阅读 3.4k
3 个回答

这样是没问题的。

不过我在想,你的 id 是不是拼在了 html 后面。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题