Skip to content

内网穿透 by FRP + 进阶-不带端口的url转发

服务器端设置

wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
# 小心使得万年船
cp /usr/local/frp/frps.ini /usr/local/frp/frps.ini.bak
# 服务器端该怎么改就怎么改
vim /usr/local/frp/frps.ini
sudo systemctl restart frps
# sample /usr/local/frp/frps.ini
[common] 
bind_addr = 0.0.0.0
bind_port = 7000
bind_udp_port = 7001
kcp_bind_port = 7000
# 已经被占用了,所以换到9080/9081了
#vhost_http_port = 80
#vhost_https_port = 7443
vhost_http_port = 9080
vhost_https_port = 9081
dashboard_addr = 0.0.0.0
# 用你自己的port/user/password
dashboard_port = 7002
dashboard_user = admin_user
dashboard_pwd = admin_password
log_file = /frps.log
log_level = info
log_max_days = 3
disable_log_color = false
# this is like password
token = YourToken
# 下面这行注销的话就是allow all ports to forward to
#allow_ports = 5000-5030,6690,8008,8443,13100-13104,38008,38443
max_pool_count = 50
# unlimited
#max_ports_per_client = 0
#subdomain_host = 10244201.xyz
tcp_mux = true

客户端

# 以上的图形设置等同于下面的设置
# frpc configuration
[common]
server_addr = 1.1.1.1 # host_ip
server_port = 7000
token = YourToken
# so it will print out to the docker run-time log
#log_file = /tmp/frpc.log
log_level = info
log_max_days = 2
tcp_mux = true
protocol = tcp
login_fail_exit = false
user = local_user_name

[specific_wiki]
type = http
local_ip = 10.0.0.199
local_port = 80
remote_port = 9080
custom_domains = wiki.xxx.xxx
use_encryption = true
use_compression = true

然后在CloudFlare之类的DNS管理界面做域名解析, 将 A node wiki解析到服务器的IP 1.1.1.1. 不能开Proxy.

到此就可以用 wiki.xxx.xxx:7080 来访问了.

但要做到用 wiki.yyy.yyy直接访问, 不用带端口. 还是再做一个url转发. 我试用了dynu.com做了一个URL转发。

Leave a Reply

Your email address will not be published.