Damus
mist profile picture
mist

Make Your Local Service Public over Internet with FRP

A NO-BS guide on how to make any of your locally running services publically available on internet.

image

This is a NO-BS guide on how to make any of your locally running services publicly available on internet. Let's get straight at it.

Often you just want to expose a local service like: - localhost:3000 // running some website - localhost:3001 // running some service to the public internet so friends or other devs can access it.

Normally this means:

  • Docker
  • Reverse proxie setup (caddy,nginx etc)
  • VPS setup (install deps, configure etc)

FRP (Fast Reverse Proxy) removes all that. Repo: github

Why FRP ?

  • No docker
  • No docker-compose setup
  • No reverse Proxy setup (caddy, nginx)

Setup in Two steps:

  • Run frps on your vps (vps has a public ip)
  • Run frpc on client, your local machine

That's it! your local server becomes available at: http://[your-vps-ip]:[remotePort]


Here's a quick step-by-step guide to do it.

Let's assume: There is some web-app/service running on: localhost:3000 & localhost:3001

  1. Install frp on both vps & your local machine: https://github.com/fatedier/frp/releases/tag/v0.66.0
    • you can choose the latest release
    • enter this in your terminal:
wget https://github.com/fatedier/frp/releases/download/v0.66.0/frp_0.66.0_linux_amd64.tar.gz
tar -xzf frp_0.66.0_linux_amd64.tar.gz
cd frp_0.66.0_linux_amd64
  1. You'll see these files in the directory:

    • frpc
    • frpc.toml
    • frps
    • frps.toml
    • LICENSE
  2. On your vps:

    • [Optinal]

      • check if firewall is enabled: sudo ufw status
      • if ufw is enabled allow required ports: sudo ufw allow 7000 sudo ufw allow 8081 sudo ufw allow 8082
      • If UFW is not enabled, you can skip this step.
    • (Note: 7000 is the FRP control port; 8081 / 8082 are the public ports exposed by FRP.)

    • edit the frps config, for example:

    bindPort = 7000
    auth.token="meow"
    
    • auth.token is a secret string that your local-machine & vps share for auth.
    • bindPort is the port with which the client (frpc) will communicate
    • start the frps by entering this cmd in terminal:
      • ./frps -c frps.toml
  3. On local machine:

    • start any service, let's say a website is running on port: 3000
    • edit the frpc.toml config file:
      serverAddr = "<your-vps-ip>"
      serverPort = 7000
      auth.token="meow"
      
      [[proxies]]
      name = "web-app-1"
      type = "tcp"
      localIP = "127.0.0.1"
      localPort = 3000
      remotePort = 8081
      
      [[proxies]]
      name = "web-app-2"
      type = "tcp"
      localIP = "127.0.0.1"
      localPort = 3001
      remotePort = 8082
      
    • start the frp client on you local machine
      • ./frpc -c frpc.toml

!! Security notes (important)

  • These ports are public
  • Anyone can access them
  • Use strong tokens
  • Do not expose sensitive services without proper security

Yup -- That's it, your services are online & publicly accessible, you can check them here: http://[your-vps-ip]:[remotePort]

FRP supports many more features like custom domains, TLS, encryption, security,load balancing, and much more.

This guide only covers a basic quickstart — be sure to read the official FRP README for advanced setups.