在本地环境中转发 MSA 开发端口(MAC)
Forwarding Ports on MSA development on local environment(MAC)
我想做一个这样的开发环境
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 文件似乎可以做到这一点,但我很困惑如何做到这一点。
一些链接指南对我很有帮助。
谢谢。
好的。我用这种方法清除了我的问题。
/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;
}
}
...
我想做一个这样的开发环境
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 文件似乎可以做到这一点,但我很困惑如何做到这一点。
一些链接指南对我很有帮助。 谢谢。
好的。我用这种方法清除了我的问题。 /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;
}
}
...