frp icon indicating copy to clipboard operation
frp copied to clipboard

如何将本地的多个web内网穿透到云服务器上的frps

Open m986883511 opened this issue 3 years ago • 2 comments

云服务器上的设置

frps.ini

[common] bind_port = 7000 vhost_http_port = 8080

本地web1

frpc.ini

[common] server_addr = x.x.x.x server_port = 7000

[web] type = http local_port = 80 custom_domains = 23.23.23.23

本地另外一台机器上web2,这里怎么设置呢?

frpc.ini

[common] server_addr = x.x.x.x server_port = 7000

[web] type = http local_port = 80 custom_domains = 23.23.23.23

m986883511 avatar Jul 05 '22 01:07 m986883511

nginx?

snowdream avatar Jul 12 '22 07:07 snowdream

之前过研究过,后来还是放弃了,就是用楼上说的 Nginx 比较方便。

多个 web 配置多个域名好像可以,还有个子域名 subdomain 可以配置,但是能不能都是 80 端口就不知道了(试一下,如果不行那就不好玩了)

heyzqq avatar Aug 22 '22 15:08 heyzqq

frpc

web1

[http_xx_sub]
type = http
subdomain = xx
local_ip = 127.0.0.1
local_port = 8080

[http_xy_sub]
type = http
subdomain = xy
local_ip = 192.168.1.100
local_port = 8081

[http_xx_cus]
type = http
custom_domains = xx.example.org
local_ip = 127.0.0.1
local_port = 8080

[http_xy_cus]
type = http
custom_domains = xy.example.org
local_ip = 192.168.1.100
local_port = 8081

web2

[http_zx_sub]
type = http
subdomain = zx
local_ip = 127.0.0.1
local_port = 8080

[http_zy_sub]
type = http
subdomain = zy
local_ip = 192.168.1.101
local_port = 8081

[http_zx_cus]
type = http
custom_domains = zx.example.org
local_ip = 127.0.0.1
local_port = 8080

[http_zy_cus]
type = http
custom_domains = zy.example.org
local_ip = 192.168.1.101
local_port = 8081

没有买域名就改下host?

docker 里面访问

docker run -d .... \
    --add-host zx.example.com:23.23.23.23 \
    --add-host zy.example.com:23.23.23.23 \
    --add-host xx.example.com:23.23.23.23 \
    --add-host xy.example.com:23.23.23.23 \
    .....

https://docs.docker.com/engine/reference/commandline/run/#options

    extra_hosts:
      - "zx.example.com:23.23.23.23"
      - "zy.example.com:23.23.23.23"
      - "xx.example.com:23.23.23.23"
      - "xy.example.com:23.23.23.23"

https://docs.docker.com/compose/compose-file/#extra_hosts

电脑

https://learn.microsoft.com/en-us/windows/powertoys/hosts-file-editor https://zhuanlan.zhihu.com/p/33818947

或者在路由器里面改

https://zhuanlan.zhihu.com/p/68934976

zctmdc avatar Dec 02 '22 19:12 zctmdc