frp
Update history
| Date | Version | Author | Update content |
|---|---|---|---|
| 2024-8-13 | v0.1 | xwj |
|
Note: Exposing services directly to the public internet is very dangerous! It is recommended to use HTTPS.
To use frp, you need to create your own configuration file. You can refer to the frp documentation.
Here is an example to access an internal web service via frp.
Start the frps Service
First, you need a server with a public IP address and start the frps service on it. Let's assume the server IP address is 20.190.1.1. Replace this IP with your own public IP.
Download and extract frp. After extracting, go to the folder:
wget https://github.com/fatedier/frp/releases/download/v0.59.0/frp_0.59.0_linux_riscv64.tar.gz tar -xzvf frp_0.59.0_linux_riscv64.tar.gz cd frp_0.59.0_linux_riscv64Create the configuration file
frps.yaml:bindPort: 7000 vhostHTTPPort: 8080Start the frps service:
./frps -c frps.yaml
Start the frpc Service
SSH into the NanoKVM;
Run
frpc -vto check the version. If there is no output, install frpc manually;- Download and extract frp;
- Move the
frpcfile to the/usr/bin/directory.
Create the configuration file
/etc/kvm/frpc.yaml:serverAddr: 20.190.1.1 # Your public IP serverPort: 7000 proxies: - name: nanokvm type: http localPort: 80 customDomains: - 20.190.1.1Start the frpc service:
frpc -c /etc/kvm/frpc.yaml
After both frps and frpc services are started, you can access the NanoKVM via the public internet by entering 20.190.1.1:8080 in your browser.
Configure Domain
To configure a domain for NanoKVM, modify the frpc.yaml file:
serverAddr: 20.190.1.1 # Your public IP
serverPort: 7000
proxies:
- name: nanokvm
type: http
localPort: 80
customDomains:
- www.yourdomain.com # Your domain
Then point the domain www.yourdomain.com to 20.190.1.1.
You can now access NanoKVM by opening http://www.yourdomain.com:8080 in your browser.
Configure HTTPS
Refer to the frp documentation: Enable HTTPS for local HTTP services.
Configure the
frps.yamlfile:bindPort: 7000 vhostHTTPSPort: 443Configure the
frpc.yamlfile:serverAddr: 20.190.1.1 # Your public IP serverPort: 7000 proxies: - name: nanokvm type: https customDomains: - yourdomain.com # Your domain plugin: type: https2http localAddr: 127.0.0.1:80 crtPath: ./server.crt # Certificate path keyPath: ./server.key # Private key path hostHeaderRewrite: 127.0.0.1 requestHeaders: set: x-from-where: frpStart both frps and frpc services, then access
https://yourdomain.comin your browser.