fatedier / frp
- четверг, 4 августа 2016 г. в 03:14:30
Go
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.Now, it supports tcp, http and https protocol when requests can be forwarded by domains to backward web services.
frp is under development and you can try it with latest release version.Master branch for releasing stable version when dev branch for developing.
We may change any protocol and can't promise backward compatible.Please note the release log when upgrading.
First, download the latest version programs from Release page according to your os and arch.
Put frps and frps.ini to your server with public IP.
Put frpc and frpc.ini to your server in LAN.
Modify frps.ini, configure a reverse proxy named [ssh]:
# frps.ini
[common]
bind_port = 7000
[ssh]
listen_port = 6000
auth_token = 123
Start frps:
./frps -c ./frps.ini
Modify frpc.ini, set remote frps's server IP as x.x.x.x:
# frpc.ini
[common]
server_addr = x.x.x.x
server_port = 7000
auth_token = 123
[ssh]
local_port = 22
Start frpc:
./frpc -c ./frpc.ini
Connect to server in LAN by ssh assuming that username is test:
ssh -oPort=6000 test@x.x.x.x
Sometimes we need to expose a local web service behind a NAT network to others for testing with your own domain and unfortunately we can't resolve a domain to a local ip.
Howerver, we can expose a http or https service using frp.
Modify frps.ini, configure a http reverse proxy named [web] and set http port as 8080, custom domain as www.yourdomain.com:
# frps.ini
[common]
bind_port = 7000
vhost_http_port = 8080
[web]
type = http
custom_domains = www.yourdomain.com
auth_token = 123
Start frps:
./frps -c ./frps.ini
Modify frpc.ini and set remote frps server's IP as x.x.x.x. The local_port is the port of your web service:
# frpc.ini
[common]
server_addr = x.x.x.x
server_port = 7000
auth_token = 123
[web]
type = http
local_port = 80
Start frpc:
./frpc -c ./frpc.ini
Resolve A record of www.yourdomain.com to x.x.x.x or CNAME record to your origin domain.
Now your can visit your local web service from url http://www.yourdomain.com:8080
.
auth_token
is used in frps.ini for authentication when frpc login in and you should configure it for each proxy.
Client should set a global auth_token
equals to frps.ini.
Note that time duration bewtween frpc and frps shouldn't exceed 15 minutes because timestamp is used for authentication.
Defalut value is false, you could decide if the proxy should use encryption or compression whether the type is:
# frpc.ini
[ssh]
type = tcp
listen_port = 6000
auth_token = 123
use_encryption = true
use_gzip = true
If your want to add a new reverse proxy and avoid restarting frps, you can use this feature.
dashboard_port
should be set in frps.ini:
# frps.ini
[common]
bind_port = 7000
dashboard_port = 7500
Start frps:
./frps -c ./frps.ini
Modify frps.ini to add a new proxy [new_ssh]:
# frps.ini
[common]
bind_port = 7000
dashboard_port = 7500
[new_ssh]
listen_port = 6001
auth_token = 123
Execute reload
command:
./frps -c ./frps.ini --reload
Start frpc and [new_ssh] is available now.
Privilege mode is used for who don't want to do operations in frps everytime adding a new proxy.
All proxies's configures are set in frpc.ini when privilege mode is enabled.
Enable privilege mode and set privilege_token
.Client with the same privilege_token
can create proxy automaticly:
# frps.ini
[common]
bind_port = 7000
privilege_mode = true
privilege_token = 1234
Start frps:
./frps -c ./frps.ini
Enable privilege mode for proxy [ssh]:
# frpc.ini
[common]
server_addr = x.x.x.x
server_port = 7000
privilege_token = 1234
[ssh]
privilege_mode = true
local_port = 22
remote_port = 6000
Start frpc:
./frpc -c ./frpc.ini
Connect to server in LAN by ssh assuming that username is test:
ssh -oPort=6000 test@x.x.x.x
Interested in getting involved? We would like to help you!
Note: We prefer you to give your advise in issues, so others with a same question can search it quickly and we don't need to answer them repeatly.