Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frp透传内网的web服务 #40

Open
dalaolala opened this issue Jan 27, 2022 · 1 comment
Open

frp透传内网的web服务 #40

dalaolala opened this issue Jan 27, 2022 · 1 comment

Comments

@dalaolala
Copy link
Owner

dalaolala commented Jan 27, 2022

安装服务端

下载最新版本并安装到对应的目录

wget https://ghproxy.com/https://github.com/fatedier/frp/releases/download/v0.39.0/frp_0.39.0_linux_amd64.tar.gz
tar -zxvf frp_0.39.0_linux_amd64.tar.gz
mv frp_0.39.0_linux_amd64 frp

注册为服务

vim /etc/systemd/system/frp.service

服务内容如下,这里注意启动的路径要正确

[Unit]
Description=Frp Server Service
After=network.target

[Service]
Type=simple
ExecStart=/root/frpdemo/frps -c /root/frpdemo/frps.ini
TimeoutStartSec=0
KillMode=process
KillSignal=SIGTERM
Restart=on-failure
RestartSec=60s

[Install]
WantedBy=default.target
systemctl daemon-reload
systemctl  start frp

安装客户端

同服务端,服务启动路径和格式如下

/home/devops/frp/frpdemo/frpc -c /home/devops/frp/frpdemo/frpc.ini

配置文件

配置默认外网地址为8.8.8.8 内网地址为192.168.1.1
服务端frps.ini

[common]
#穿透的端口
bind_port = 7000
#http端口设置
vhost_http_port = 8047
#客户端连接令牌
token = mytoken
#https端口设置
#vhost_https_port=8047
#显示的日志级别
log_level = info
#https端口设置
#vhost_https_port=8047

客户端frpc.ini

[common]
server_addr = 8.8.8.8
server_port = 7000
token = mytoken

[web01]
type = http
local_ip =192.168.1.1
local_port =8080
custom_domains = 8.8.8.8

此时 访问 8.8.8.8:8047 就可以访问内网的192.168.1.1:8080

使用自定义绑定域名 实现 内网多 WEB 穿透。

[web00] 
type = http 
local_ip = 192.168.1.2 
local_port = 80 
custom_domains = xx0.domain_name 

[web01] 
type = http 
local_ip = 192.168.1.3
local_port = 81 
custom_domains = xx1.domain_name 

使用TCP端口多内网 穿透

[web00] 
type = tcp 
local_ip = 192.168.1.2
local_port = 80
remote_port = 40001 

[web01] 
type = tcp
local_ip = 192.168.1.3
local_port = 81 
remote_port = 40002 
@dalaolala
Copy link
Owner Author

dalaolala commented Apr 13, 2022

frp配置多个内网服务参考如下地址

https://www.cnblogs.com/JasonCeng/p/14375087.html

关于配置多个web访问的讨论

https://github.com/fatedier/frp/issues/914

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant