1. Background
During development, we often encounter situations that require a public domain name, which can generally be divided into two scenarios:
One is wanting to show our local development results to others, which requires publishing them to the public internet;
The other is for things like WeChat development, which requires a public network address to complete debugging.
If it is just for temporary use, buying a VPS and deploying on it is very inconvenient. Using frp for intranet penetration solves these two problems; it can directly map the local machine to the public network, saving the trouble of deploying on a server.
2. Client configuration, client download address (use the latest version). https://github.com/fatedier/frp/releases . Select: frp_0.42.0_windows_amd64.zip . As shown in Figure 1

3. After downloading, you need to trust this file. Antivirus software will delete the files inside, so you need to add an exclusion. Extract to: C:\frp_0.42.0_windows_amd64 . As shown in Figure 2

4. Modify frpc.ini . The top part is the server configuration, and the bottom part is your local machine configuration. The original configuration is as follows
[common]
server_addr = 127.0.0.1
server_port = 7000
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
5. The modified example is as follows
[common]
server_addr = x.x.x.x
server_port = 5000
token = aaa
[chengdu-wangqiang-x-local]
type = http
local_ip = 127.0.0.1
local_port= 8001
custom_domains = chengdu-wangqiang-x-local.frp.x.top
6. Start frpc: frpc -c frpc.ini. If you are a Windows user, you need to execute the command in a cmd terminal. It prompts Access denied. Open 360 Antivirus, and restore the frp-related files from the 360 Quarantine. Run it again, and it prompts: login to server failed: authorization failed. The value of token = aaa is incorrect and needs to be obtained from the server side. As shown in Figure 3

C:\Windows\system32>cd ..
C:\Windows>cd ..
C:\>cd frp_0.42.0_windows_amd64
C:\frp_0.42.0_windows_amd64>.\frpc -c .\frpc.ini
Access denied.
C:\frp_0.42.0_windows_amd64>.\frpc -c .\frpc.ini
2022/05/11 11:42:31 [E] [service.go:340] authorization failed
2022/05/11 11:42:31 [W] [service.go:128] login to server failed: authorization failed
authorization failed
7. After modification, the authorization is successful. As shown in Figure 4

C:\frp_0.42.0_windows_amd64>.\frpc -c .\frpc.ini
2022/05/11 13:38:31 [I] [service.go:349] [9199f80513ab1df9] login to server success, get run id [9199f80513ab1df9], server udp port [0]
2022/05/11 13:38:31 [I] [proxy_manager.go:144] [9199f80513ab1df9] proxy added: [chengdu-wangqiang-object-local]
2022/05/11 13:38:31 [I] [control.go:181] [9199f80513ab1df9] [chengdu-wangqiang-object-local] start proxy success
8. Edit the Nginx configuration file, add listen 8001; , where 8001 is the local service port configured in frpc.ini. Reload the configuration. As shown in Figure 5

server {
listen 8001;
listen 443 ssl;
server_name x.local;
...
}
9. Open the URL in the browser: http://chengdu-wangqiang-x-local.frp.x.top/ , and the response is 200. As shown in Figure 6

