<VirtualHost *:80>
ServerName frp.test.dev
ServerAlias *.frp.test.dev
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:7071/
ProxyPassReverse / http://127.0.0.1:7071/
</VirtualHost>
#https站点,证书路径请替换为自己的,需要强制http跳转https请自行GG。
<VirtualHost *:443>
ServerName frp.test.dev
ServerAlias *.frp.test.dev
SSLEngine on
SSLCertificateFile "/ssl/acme/frp.test.dev.cer"
SSLCertificateKeyFile "/ssl/acme/frp.test.dev.key"
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:7071/
ProxyPassReverse / http://127.0.0.1:7071/
</VirtualHost>
frp服务端
frps.toml配置
[common]
bind_port = 7000
vhost_http_port = 7071
dashboard_port = 7100
subdomain_host = frp.test.dev
Linux 下配置成服务器
创建文件/etc/systemd/system/frps.service
[Unit]
Description=fraps service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
ExecStart=/root/frp/frps -c /root/frp/frps.toml #frps服务器安装路径
[Install]
WantedBy=multi-user.target
控制frp服务器命令
#启动frps
sudo systemctl start frps
#自启动
sudo systemctl enable frps
#卸载自启动
sudo systemctl disable frps
#重启
sudo systemctl restart frps
#停止
sudo systemctl stop frps
#查看日志
sudo systemctl status frps
客户端
1下载frp软件 https://github.com/fatedier/frp/releases
- 配置frp的客户端
[common]
server_addr = 3.123.234.206 #你的ip
server_port = 7000
token = test1234@@
[http-test]
type = http
local_port = 8585
subdomain = test
[http-a]
type = http
local_port = 8000
subdomain = a
- 执行frp
frpc.exe -c frpc.toml
- 在本地配置网址,域名和frp客户端配置的相同
subdomain + 后缀