Mark Ku's Blog

Installing FRP Server on a Raspberry Pi

Problem Statement

A previous post covered how to set up an FRP reverse proxy server on Google Cloud to expose internal network sites to the internet. However, as the number of sites grew, the monthly cost kept climbing — eventually reaching $200–300 TWD. I decided to self-host FRP Server on a Raspberry Pi instead.

Step 1: Download the Latest Version of frps

wget https://github.com/fatedier/frp/releases/download/v0.47.0/frp_0.47.0_linux_arm.tar.gz

Extract the archive and rename the folder to frp:

tar -zxvf frp_0.47.0_linux_arm.tar.gz
mkdir /var/frps
mv frp_0.47.0_linux_arm/* /var/frps/
cd /var/frps

Edit the frps configuration file (sudo vim frps.ini):

# frps.ini
[common]
bind_addr = 0.0.0.0
bind_port = 7000
vhost_http_port = 80
vhost_https_port = 443
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = 你的密碼
authentication_method = token
token = frpc 連線的 token 

Run frps:

sudo ./frps -c ./frps.ini

Step 2: Configure DNS Records

Console output showing frps server starting and multiple proxies created
Console output showing frps server starting and multiple proxies created

Add a DNS A record pointing proxy.markkulab.net to the FRP Server host:

DNS A record configuration showing proxy host and IP address
DNS A record configuration showing proxy host and IP address

Add a CNAME record so that visitors accessing blog.markkulab.net get routed by frps to the mapped client-side service:

DNS CNAME record form mapping blog to proxy.markkulab.net
DNS CNAME record form mapping blog to proxy.markkulab.net
CNAME record configuration form for shop host pointing to proxy.markkulab
CNAME record configuration form for shop host pointing to proxy.markkulab

frpc.ini Configuration

[common]
server_addr = proxy.markkulab.net
server_port = 7000
auth_token = 你的密碼
pool_count = 100

[ShopCartHttps2]
type = https
custom_domains = shop.markkulab.net
local_port = 888
plugin = https2http
plugin_local_addr = 127.0.0.1:888
plugin_crt_path = /Public/shop_certificate.crt
plugin_key_path = /Public/shop_private.key
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp

[blog]
type = https
local_port = 49183
custom_domains = blog.markkulab.net
plugin = https2http
plugin_local_addr = 127.0.0.1:49183
# HTTPS 证书相关的配置
plugin_crt_path = /Public/blog_certificate.crt
plugin_key_path = /Public/blog_private.key
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp

Configure Auto-Start on Boot

Add a systemd service file under /lib/systemd/system/

sudo vim /lib/systemd/system/frps.service

Use the following configuration as a template

[Unit]
Description=FRP Server
After=network.target
Wants=network.target

[Service]
Restart=on-failure
RestartSec=5
ExecStart=/var/frps/frps -c /var/frps/frps.ini

[Install]
WantedBy=multi-user.target

Managing the Service

sudo systemctl start frps.service //啟動 FRP Server 服務
sudo systemctl stop frps.service //停止 FRP Server 服務
sudo systemctl restart frps.service //重啟 FRP Server 服務
sudo systemctl enable frps.service //開機時自動啟動 FRP Server 服務
sudo systemctl disable frps.service //開機時不要啟動 FRP Server 服務
sudo systemctl status frps.service //查看FRP Server 狀態
sudo systemctl daemon-reload  // reload service

Final Note

It turned out that network speeds through the Raspberry Pi were actually faster than through Google Cloud. I ended up keeping the Google Cloud instance as a backup line.

Author

Mark Ku

擁有 10+ 年經驗的資深軟體工程師,現為 AI 應用 Builder,專注於大型平台架構與簡化複雜系統設計,從電商系統到訂閱與收費平台,結合 AI Agent、AI 整合與自動化開發,打造高效率且可持續演進的產品技術基礎。Read More

Found this useful?

The author's free tools, daily podcasts and newsletter are all here.

Mark Ku · This article is licensed under CC BY 4.0. Credit the author and link back to the original when reusing it.

Comments

Subscribe to Newsletter

Subscribe to get new posts delivered instantly — never miss a tech share.

By submitting, you agree to receive emails. You can anytime.

Popular Posts

View all
Mark Ku
··602

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution
Mark Ku
··492

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.
Mark Ku
··334

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki
Mark Ku
··268

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning
Mark Ku
··218

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1
Mark Ku
··217

Setting Up Samba on Ubuntu to Share Folders with Windows 11

Setting Up Samba on Ubuntu to Share Folders with Windows 11