How to setup a Reverse Proxy using FRP

It enable you access your computer (needn't have public IP) anywhere with Internet connection.

This post is a quick guide to configure a frps reverse proxy server.

What is it for?

It enable you access your computer (needn't have public IP) anywhere with Internet connection.

What you need?

  • A Server with public IP
  • A computer (you want to connect to)

Step 1. Set up frp-server (on server)

On you server

vim ~/.frps

Then edit the file to:

[common]
bind_addr = 0.0.0.0
bind_port = 7000
bind_udp_port = 7001
kcp_bind_port = 7000
vhost_http_port = 80
vhost_https_port = 443
dashboard_addr = 0.0.0.0
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin
log_file = ./frps.log
log_level = info
log_max_days = 3
disable_log_color = false
allow_ports = 2000-3000,3001,3003,4000-50000
max_pool_count = 5
max_ports_per_client = 0
subdomain_host = frps.com
tcp_mux = true

Save, substitute /root/.frps on the second line to the file you just edited, and run:

docker run -d --name=frps --restart=always \
                  -v /root/.frps:/frp/frps.ini \
                  -p 7000:7000 \
                  -p 7500:7500 \
                  -p 6000:6000 \
                  -p 6001:6001 \
                  -p 6002:6002 \
                  -p 6003:6003 \
                  stilleshan/frps

Step 2. On local computer (you want to connect it via reverse proxy server)

Install frpc

# macOS
brew install frpc

# Linux
...

Find a place to save frpc.ini, such as ~/.config/frpc.ini

vim ~/.config/frpc.ini

Then edit the file (configurable) to:

[common]
server_addr = <your.server.ip.here>
server_port = 7000

[ssh]
type = tcp
local_ip = 0.0.0.0
local_port = 22
remote_port = 6000

Then run:

frpc -c ~/.config/frpc.ini

If you are a macOS user:

  • Make sure you enable the Remote Login from System Preferences - Sharing - Remote Login

Step 3. Connect and use! (on any computer)

ssh by specify a port number which you have configured in Step 2.

ssh -p 6000 [email protected]