Skip to content

Self Hosting Reverse Proxy with Fast Reverse Proxy (FRP)

Published: at 12:37 AM

Fast Reverse Proxy (FRP) is a self-hosted reverse proxy that allows you to tunnel traffic to your local development environment. This mitigates the need to open ports on your router or use a service like Cloudfront to expose your local server to the internet.

Table of contents

Open Table of contents

What is a Reverse Proxy?

A reverse proxy is a server that sits between a client and one or more servers. It intercepts requests from clients and forwards them to the appropriate server. Reverse proxies are commonly used to improve performance, security, and reliability by distributing client requests across multiple servers.

In this article, we’ll focus on setting up a reverse proxy to tunnel traffic between local envirements, but the same principles can be applied to a VPS or cloud server.

Setup Fast Reverse Proxy (FRP)

First of, you’ll need to download the FRP binary from the official website. Choose the appropriate version for your operating system and architecture.

We will use the linux_amd64 version for this tutorial.

Then extract the downloaded file and navigate to the extracted directory.

Desktop % tar -xvf frp_0.58.1_linux_amd64.tar.gz &&

cd frp_0.58.1_linux_amd64

Once extracted, you’ll have two files: frpc and frps.

Setting up the Server

First, we’ll set up the server on your VPS or cloud server.

  1. Copy the frps file and the frps.toml configuration file to your server. The frps.toml file contains the configuration settings for the server.
bindPort = 7000

This bindPort setting specifies the port that the server listens on.

  1. Start the server by running the following command:
./frps -c frps.toml

The server should now be running and listening on port 7000.

  1. On the client side, copy the frpc file and the frpc.toml configuration file to your local machine.
  2. frpc.toml needs to be configured with the server’s IP address and port.
serverAddr = "192.168.1.50"
serverPort = 7000

[[proxies]]
name = "test-tcp"
type = "tcp"
localIP = "localhost"
localPort = 22
remotePort = 6000
  1. Start the client by running the following command:
./frpc -c frpc.toml

The client should now be running and connected to the server.

Conclusion

Once the server and client are set up, you can access the client server through the remote server’s IP, in this case, 192.168.1.50:6000, which will tunnel traffic to the local client server on port 22.