Code Monkey home page Code Monkey logo

Comments (4)

superzjg avatar superzjg commented on June 13, 2024

先弄清楚 localAddrlocalIP的使用场景

from frp.

Fiary-Tale avatar Fiary-Tale commented on June 13, 2024

首先,非常感谢您的回复,为我解答疑惑,其次抱歉,我在文档中,并没有找到localAddr的使用案例,也没有找到讲解方法,但是我不使用localAddrlocalIP时,在客户端设置remotePort = 58880,服务端设置vhostHTTPPort = 58880时,我使用curl http://127.0.0.1:58880,一样会产生错误,导致我无法使用nginx反向代理设置。错误如下图
访问http://127.0.0.1:58880
image
frps配置
`bindAddr = "0.0.0.0"
bindPort = 60001
vhostHTTPPort = 58880
log.to = "console"

auth.method = "token"
auth.token = "xxxxxxxxxxx"
`

frpc配置

`serverAddr = "1.1.1.1" # 这里我写的是真实ip,1.1.1.1只是临时填写
serverPort = 60001
auth.method = "token"
auth.token = "xxxxxxxxxxx"

[[proxies]]
name = "lskyweb"
type = "http"
localIP = "127.0.0.1"
localPort = 8080
remotePort = 58880
customDomains = ["1.1.1.1"] # 这里我写的是真实ip,1.1.1.1只是临时填写
`

frps错误日志

[W] [http.go:119] do http proxy request [host: 127.0.0.1:58880] error: no route found: 127.0.0.1 /

此时如果我的vps开放了58880端口,使用curl http://x.x.x.x:58880这个时候是可以正常访问的,唯独访问localhost、127.0.0.1或内网ip的58880端口无法访问

from frp.

Fiary-Tale avatar Fiary-Tale commented on June 13, 2024

我看到,您在其他nginx反向代理的issue中提到要先添加localIP,那么我添加localIP后,配置如下:

`serverAddr = "1.1.1.1"
serverPort = 60001
auth.method = "token"
auth.token = "xxxxxxx"

[[proxies]]
name = "lskyweb"
type = "http"
localIP = "127.0.0.1"
localPort = 8080
remotePort = 58880
customDomains = ["1.1.1.1"]
`

但是依旧会无法访问localhost、127.0.0.1或内网ip的58880端口,但是可以通过公网ip进行访问,我在公网服务器的shell中
访问错误如下:
image
2024/01/06 22:09:16 [W] [http.go:119] do http proxy request [host: 127.0.0.1:58880] error: no route found: 127.0.0.1 /

from frp.

Fiary-Tale avatar Fiary-Tale commented on June 13, 2024

已经搞明白如何进行反向代理的设置了,需要把customDomains = ["1.1.1.1"]这个配置为customDomains = ["127.0.0.1"],就会默认转发到他的127.0.0.1:58880端口上,这样就可以做nginx反向代理了

from frp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.