【问题标题】:Nginx proxy use path(subpath) as urlNginx 代理使用路径(子路径)作为 url
【发布时间】:2018-10-03 17:55:41
【问题描述】:

我的需求如下:

如果我请求这样的网址

http://example.com/10-10-43-3

服务器从

获取资源

http://10.10.43.3

并回复我。

10-10-43-3 可以是替换 '.' 的任意 URL用'-'。

如何通过nginx实现呢?像 location 和 proxy_pass 这样的东西?

【问题讨论】:

    标签: nginx nginx-location nginx-reverse-proxy


    【解决方案1】:

    以下内容应该可以帮助您入门。

    location /10-10-43-3 {
      proxy_pass http://10.10.43.3;
    }
    

    如果需要考虑其他重定向,您很可能需要在上述内容中添加变体以及正则表达式处理。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-27
      • 2019-05-27
      • 1970-01-01
      • 2019-04-16
      • 2017-10-10
      • 1970-01-01
      • 1970-01-01
      • 2012-06-17
      相关资源
      最近更新 更多