Expose Your Home Web Server to the Internet with frp – A Complete Step‑by‑Step Guide
This tutorial shows how to use frp for internal‑network penetration, configuring both the frps server and frpc client, integrating with Nginx, adding optional access control, and handling domain mapping so a home‑hosted website becomes reachable from the public internet.
Server‑Side Configuration (frps)
Based on a previous article, add the vhost_http_port parameter to the frps.ini file to receive HTTP requests. Open the required ports in the firewall or through a control panel such as Baota. In the example, Nginx listens on port 80 and forwards domain traffic to frps’s port 8080; you may also let frps use port 80 directly.
[common]
bind_addr=0.0.0.0
bind_port=7000
vhost_http_port=8080
token=12310086
dashboard_port=7500
dashboard_user=admin
dashboard_pwd=admin123Start the server with:
./frps -c frps.iniClient‑Side Configuration (frpc) on the Home Machine
Configure the client to expose the local web service (port 80) to the public server:
[common]
server_addr=YOUR_SERVER_IP
server_port=7000
token=12310086
[http] # connection name can be any descriptive label
type=http
local_ip=127.0.0.1
local_port=80
use_encryption=false
use_compression=true
custom_domains=frp.example.com # replace with your domainStart the client with:
./frpc -c frpc.iniExplanation of Key Parameters
use_encryption: set to false here; enable if you need encrypted traffic. use_compression: enables data compression, which can improve transfer speed. custom_domains: the domain name that will be bound to this service; it is mandatory for frpc to start.
Access Control (Optional)
To protect the exposed service, add http_user and http_pwd in the client’s [http] section:
http_user=admin
http_pwd=adminFull Configuration with Sub‑domain Support
If you want to serve multiple services under different sub‑domains, add subdomain_host on the server and subdomain on the client:
# frps.ini
[common]
bind_addr=0.0.0.0
bind_port=7000
vhost_http_port=8080
token=12310086
subdomain_host=example.com
# frpc.ini
[common]
server_addr=103.255.61.100
server_port=7000
token=12310086
[http]
type=http
local_ip=127.0.0.1
local_port=80
use_encryption=false
use_compression=true
subdomain=frp
[tomcat]
type=http
local_ip=127.0.0.1
local_port=8080
use_encryption=false
use_compression=true
subdomain=tomcatExecution Flow
The home machine runs a web server on port 80.
frpc reads its configuration and forwards the local port 80 to the server’s port 8080.
On the public server, Nginx listens on port 80 and proxies domain requests to frps’s port 8080.
frps then forwards those requests back to the home machine’s port 80.
The round‑trip enables external users to access the internal web service via the domain.
Important Notes
Directly accessing PUBLIC_IP:8080 will not work because frps only forwards traffic received from Nginx.
When binding multiple domains to the same internal service, separate them with commas in custom_domains.
HTTPS certificates should be installed on the Nginx side, though frp also offers a plugin for TLS termination on the client.
Common Errors
If frpc fails to start, you will see an error screen similar to the one shown in the original article (e.g., missing configuration or port conflict).
Images
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
