V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
CSGO
V2EX  ›  宽带症候群

frp 如何添加多个 80 端口?

  •  
  •   CSGO · 2020-12-17 00:04:58 +08:00 · 3758 次点击
    这是一个创建于 1197 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我今天学习了 exsi 虚拟机,然后成功在下面安装了 lede,并且现在可以正常上网了。 现在客户端 frpc 是这样配置:

    [common] server_addr = wangyifang.com server_port = 7000 token = password

    [Raspberry-Pi-SSH] type = tcp local_ip = 192.168.100.102 local_port = 22 remote_port = 7998

    [Raspberry-Pi-VNC] type = tcp local_ip = 192.168.100.102 local_port = 5901 remote_port = 7999

    [LEDE 软路由 SSH] type = tcp local_ip = 192.168.100.1 local_port = 22 remote_port = 7005

    [PC 远程桌面] type = tcp local_ip = 192.168.100.101 local_port = 3389 remote_port = 7006

    [LEDE 软路由后台] type = http local_ip = 192.168.100.1 local_port = 80 custom_domains = wangyifang.com

    ================ 这是原本的配置,但是我想着如果可以把 exsi 也放到公网上就好了,就想着把最后一个改为如:

    [LEDE 软路由后台] type = http local_ip = 192.168.100.1 local_port = 80 custom_domains = wangyifang.com remote_port = 7100

    [LEDE 软路由后台] type = http local_ip = 192.168.100.100 local_port = 80 custom_domains = wangyifang.com remote_port = 7101

    这样发现 wangyifang.com:7100 都已经不能访问 lede 后台了。而我知道 frp 的 Http Port: 7002,所以是不是 frp 只能有一个这样的记录?

    25 条回复    2020-12-22 23:39:48 +08:00
    stille
        1
    stille  
       2020-12-17 00:09:56 +08:00 via iPad
    type 为 http/s 时不用 remoteport
    CSGO
        2
    CSGO  
    OP
       2020-12-17 00:12:35 +08:00
    @stille 也就是说端口都只能是 7002 。那么只能用不同访问域名?
    stille
        3
    stille  
       2020-12-17 00:26:27 +08:00
    远程 frps 服务端的 http/https 协议会根据请求的 custom_domain 来分别穿透对应的内网 IP 和端口的.
    所以说你用 http 协议,就不能 2 个域名相同

    主要我不知道你 frps 放在哪,环境如何
    CSGO
        4
    CSGO  
    OP
       2020-12-17 00:37:38 +08:00
    @stille frps 是放在云服务器上啊。frpc 是在软路由上。
    stille
        5
    stille  
       2020-12-17 00:38:30 +08:00 via iPad
    @CSGO 你修改后的 2 条记录用了同一个域名,你可以搞个 esxi.xx.com 二级域名给 100,用不同域名加 7002 就可以访问 esxi 和路由器
    stille
        6
    stille  
       2020-12-17 00:41:44 +08:00 via iPad
    CSGO
        7
    CSGO  
    OP
       2020-12-17 00:52:27 +08:00 via Android
    @stilleesxi.xx.com 域名解析到哪里?
    ysc3839
        8
    ysc3839  
       2020-12-17 03:53:18 +08:00 via Android
    @CSGO 域名都解析到 frps 服务器。
    另外建议用 https,而且是在 frpc 这边设置 https 。因为印象中 frp 的 TLS 没有验证对端证书的功能,有被中间人攻击的可能性。
    即使 frp 之间的 TLS 连接是可验证的,frps 暴露出去的端口也应该开启 https 。
    baozhuo
        9
    baozhuo  
       2020-12-17 08:27:13 +08:00 via Android
    我是这样搞的,先通配符解析一个二级域名到云服务,frpc 里面每个 http/s 都单独配置一个二级域名,云服务那边再用 nginx 反向代理一下,很贱的就解决了嘛
    CSGO
        10
    CSGO  
    OP
       2020-12-17 11:57:14 +08:00
    @ysc3839

    我添加了:

    [EXSI 后台]
    type = http
    local_ip = 192.168.100.100
    local_port = 80
    custom_domains = exsi.wangyifang.com

    [EXSI-SSH]
    type = tcp
    local_ip = 192.168.100.100
    local_port = 22
    remote_port = 7007

    测试了,ssh 可以,后台的话还是不行,打开居然直接跳到我网站了。
    CSGO
        11
    CSGO  
    OP
       2020-12-17 19:39:46 +08:00
    我发现了 exsi 原来是 443 端口。在局域网内访问 192.168.100.100:443 可以访问,访问 192.168.100.100:80 是无法打开网页。

    所以我现在是这样配置:

    [EXSI-后台]
    type = http
    local_ip = 192.168.100.100
    local_port = 443
    custom_domains = exsi.wangyifang.com

    但是,访问现在终于似乎有点起色,但是还是无法正确访问,打开出现这样的画面:

    The page you requested was not found.
    Sorry, the page you are looking for is currently unavailable.
    Please try again later.

    The server is powered by frp.

    Faithfully yours, frp.
    qanniu
        12
    qanniu  
       2020-12-18 09:24:53 +08:00
    我也遇到同样的问题,暂时观望解决方案中。
    Lunatic1
        13
    Lunatic1  
       2020-12-18 09:43:34 +08:00
    http 协议不设置远程端口
    CSGO
        14
    CSGO  
    OP
       2020-12-18 11:41:32 +08:00 via Android
    @Lunatic1 看下 11 楼,还是不行
    Lunatic1
        15
    Lunatic1  
       2020-12-18 13:10:46 +08:00
    http 本地端口一般都是 80 吧,不用配置 443 。域名指向 frp 中转服务器就行了,包括二级。你 10L 配置的是正确的
    AoEiuV020
        16
    AoEiuV020  
       2020-12-19 11:45:59 +08:00
    第一反应是套 nginx 反向代理,frp 这种不专业的反代肯定是有极限的,哪怕这次的功能费劲配置出来了,下次有其他功能 frp 也未必支持,太折腾,
    SgtPepper
        17
    SgtPepper  
       2020-12-20 09:40:36 +08:00 via Android
    frps 中把 https 删掉,frpc type 用 tcp 试试
    SgtPepper
        18
    SgtPepper  
       2020-12-20 09:45:44 +08:00 via Android
    @stille 二级域名的话 ssl 证书怎么弄呢,比如我的域名 abc.com ,绑定的证书 www.abc.comabc.com
    添加*解析后,frps frpc 添加二级域名,实测用 test.abc.com 去访问地址提示证书错误。
    stille
        19
    stille  
       2020-12-20 13:24:27 +08:00 via iPhone
    @SgtPepper 申请泛域名证书,我博客里有教程 *.xxx.com 的证书
    SgtPepper
        20
    SgtPepper  
       2020-12-20 13:52:37 +08:00
    @stille 看到了,thx
    CSGO
        21
    CSGO  
    OP
       2020-12-21 15:40:27 +08:00
    @SgtPepper 删掉 https 后,用 http 也不行。用 tcp 也不行。
    CSGO
        22
    CSGO  
    OP
       2020-12-21 15:42:36 +08:00
    @SgtPepper 下面两个都试了都不行。

    [EXSI-后台]
    type = http
    local_ip = 192.168.100.100
    local_port = 443
    custom_domains = exsi.wangyifang.com

    [EXSI-后台]
    type = tcp
    local_ip = 192.168.100.100
    local_port = 443
    remote_port = 7010
    SgtPepper
        23
    SgtPepper  
       2020-12-22 14:38:30 +08:00
    frps 你怎么配的啊?
    CSGO
        24
    CSGO  
    OP
       2020-12-22 23:31:33 +08:00
    @SgtPepper

    这样配置的:

    [common]
    bind_port = 7000
    dashboard_port = 7001
    token = 4E****************6Dn^q
    dashboard_user = admin
    dashboard_pwd = 4E****************6Dn^q
    vhost_http_port = 7002
    SgtPepper
        25
    SgtPepper  
       2020-12-22 23:39:48 +08:00
    frpc 里面指定了 remote_port 的话 frps 里面的 vhost_http_port 去掉试试
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3304 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 11:27 · PVG 19:27 · LAX 04:27 · JFK 07:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.