- Get the binary: https://github.com/fatedier/frp/releases
- wget it to your directory
tar -xvzf frp_0.53.2_linux_amd64.tar.gz
vi frps.toml
bindAddr = "0.0.0.0"
bindPort = 27000
kcpBindPort = 27000
vhostHTTPPort = 27000
vhostHTTPSPort = 27000
auth.method = "token"
auth.token = "your-secret-pass"
subDomainHost = "dev.example.com"
custom404Page = "/var/www/html/404.html"
screen -S frp
./frps -c ./frps.toml
- Generate manual certs for dev.example.com and *.dev.example.com
- Setup nginx
server {
listen 443 ssl;
server_name dev.example.com;
ssl_certificate /etc/letsencrypt/live/dev.example.com-0001/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dev.example.com-0001/privkey.pem;
location / {
return 404;
}
}
server {
listen 443 ssl;
server_name ~^.+\.dev\.example\.com$;
ssl_certificate /etc/letsencrypt/live/dev.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dev.example.com/privkey.pem;
location = /robots.txt {
return 200 "User-agent: *\nDisallow: /\n";
}
location / {
proxy_pass http://127.0.0.1:27000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header host $host;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-forward-for $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_buffering off;
proxy_redirect off;
}
}
wget
cp frp_0.53.2_darwin_arm64/frpc /usr/local/bin/
- Create
frpc.toml
loginFailExit = false
transport.tls.enable = false
auth.method = "token"
auth.token = "your-secret-pass"
serverAddr = "127.0.0.1"
serverPort = 27000
[[proxies]]
name = "web"
type = "http"
localIP = "localhost"
localPort = 3333
subdomain = "custom-subdomain"
frpc -c deploy/proxy/frpc.toml