Expose Local Server by FRP (Fast Reverse Proxy)

3 months ago
0 comment

FRP Introductions

Introduction & Code Repository

Please briefly read the documentation, as this will help you understand the meaning of each configuration below.

Server-side (FRPS)

You have to install FRPS on your public network server, so that you can use it as a reserve proxy later.

Thanks to MvsCode for the simple installation script: Github Repository

  • Bind port: the port where the traffic goes
  • vhost http port: port for http web sites (I use the default: 80)
  • vhost https port: port for https web sites (I use the default: 443)
  • Dashboard port: after installation there will be an overview backend page, this is the port it will be accessed on
  • token: the equivalent of a password, the client and server must have the same token

For configuration options that you do not understand, please just use the default values.

The script will display your configurations when the installation is complete and I recommend saving them in case you forget them.

To control FRPS, use command frps {start | stop | restart | status | config | version}.

Client-side (FRPC)

Download FRPC from: Github - releases.

Then edit frpc.ini.

Access Local HTTP & HTTPS Service with Custom Domain

frpc.ini:

[common]
server_addr = frps_server_ip/domain
server_port = frps_server_bind_port
token = frps_server_token

[web-http]
type = http
local_port = local_http_port (usually 80)
custom_domains = your_domain

[web-https]
type = https
local_port = local_https_port (usually 443)
custom_domains = your_domain

Note that you need to add an A record to your domain's DNS which points to the IP of your FRPS server (not your local machine).

Save frpc.ini and execute frpc -c frpc.ini.

Then you should be able to access your local service by your custom domain.

Forwarding TCP Traffic

frpc.ini:

[common]
server_addr = frps_server_ip/domain
server_port = frps_server_bind_port
token = frps_server_token

[tcp_proxy]
type = tcp
local_ip = 127.0.0.1
local_port = local_tcp_port
remote_port = remote_tcp_port

Save frpc.ini and execute frpc -c frpc.ini.

Then you should be able to access your local TCP connection via server_addr:remote_port.

Attached: Setting Up FRPC on Ubuntu

First tar -xzf to unzip the FRPC package.

Enter the directory and execute:

chmod +x ./frpc
cp ./frpc /usr/bin/
mkdir /etc/frp
cp ./frpc.ini /etc/frp
cp ./systemd/frpc.service  /lib/systemd/system
systemctl enable frpc.service
service frpc start