【问题标题】:Forwarding Ports on MSA development on local environment(MAC)在本地环境(MAC)上进行 MSA 开发的转发端口
【发布时间】:2022-01-20 20:12:24
【问题描述】:

我想做一个这样的开发环境。

http://local-a.com -> redirects to localhost:8080
https://local-a.com -> redirects to localhost:8443

http://local-b.com -> redirects to localhost:8090
https://local-b.com -> redirects to localhost:9443

http://local-c.com -> redirecnts to localhost:8100
https://local-c.com -> redirects to localhost:10443

你能建议怎么做吗? 似乎 /etc/pf.conf 文件和 /etc/hosts 文件可以做到这一点,但我很困惑如何做到这一点。

只是一些链接指南会对我有所帮助。 谢谢。

【问题讨论】:

    标签: networking portforwarding


    【解决方案1】:

    好的。我用这种方法解决了我的问题。 /etc/hosts

    127.0.0.1 local-a.com
    127.0.0.1 local-b.com
    127.0.0.1 local-c.com
    

    使用 nginx.conf

    server {
      listen       80;
      server_name local-a.com;
      location / {
        proxy_set_header Host $host;
        proxy_set_header X-Front-Server-Ip $remote_addr;
        proxy_set_header X-Forwarded-Proto 'http';
        proxy_pass http://localhost:8080;
      }
    }
    server {
      listen       80;
      server_name local-b.com;
      location / {
        proxy_set_header Host $host;
        proxy_set_header X-Front-Server-Ip $remote_addr;
        proxy_set_header X-Forwarded-Proto 'http';
        proxy_pass http://localhost:8090;
      }
    }
    ...
    

    【讨论】:

      猜你喜欢
      • 2017-04-07
      • 2019-04-03
      • 1970-01-01
      • 1970-01-01
      • 2010-12-17
      • 1970-01-01
      • 1970-01-01
      • 2015-05-07
      • 2015-03-26
      相关资源
      最近更新 更多