內網穿透,Frp服務端和客戶端設置教程


frp配置文件設置
frp配置文件分為服務端和客戶端,想要正常只用frp工具,我們需要對服務端和客戶端的配置文件分別進行設置。

frps.ini(服務端)配置文件解釋說明

[common]
# 服務端控制面板訪問賬號和密碼,不設置則默認admin
#注意以及幾個是我隨便填寫的,請根據自己的實際情況,自行修改。
dashboard_user = user
dashboard_pwd = password
# 客戶端連接令牌
token = access_token
# 路由地址
subdomain_host = frp.x.com

###########下列配置默認即可,無需改動###############
#穿透監聽端口與地址(0.0.0.0表示允許任何地址)
bind_addr = 0.0.0.0
bind_port = 7000
# udp協議監聽端口
bind_udp_port = 7001
#udp協議支持kcp模式。kcp的運行端口,不設置表示禁用。可以與'bind_port'端口一致
kcp_bind_port = 7000
#虛擬主機穿透監聽端口(指http與https的訪問端口)
vhost_http_port = 80
vhost_https_port = 443
#服務端控制面板訪問端口
dashboard_addr = 0.0.0.0
dashboard_port = 7500
# frp日志記錄路徑
log_file = ./frps.log
# 日志記錄級別(trace, debug, info, warn, error)
log_level = info
# 日志記錄滾動天數
log_max_days = 3
# 客戶端與服務端連接心跳檢測
heartbeat_timeout = 90
# 允許客戶端使用的穿透端口,不設置則全部允許
#allow_ports = 1000-100000
# 穿透服務允許的連接數
max_pool_count = 5
# 單個客戶端允許建立的穿透服務,0為不限制
max_ports_per_client = 0
# 連接超時
authentication_timeout = 900
# tcp流多路復用(可以理解為優化傳輸) 
tcp_mux = true

frpc.ini(客戶端)配置文件解釋說明

#該配置文件,我做了相關的刪減,只保留了我們最常用到的幾個穿透功能。
#[common為公共配置區域必須存在]
[common]
# 與服務端連接令牌
token = access_token
# 客戶端標識
user = nas
#服務端的訪問地址(可用ip或者域名)。
server_addr = 111.222.222.111

####################此處為common的默認配置區域無需修改###################
#服務端用於穿透的端口,與服務端保持一致。
server_port = 7000
# 日志記錄路徑
log_file = ./frpc.log
# 日志記錄級別(trace, debug, info, warn, error)
log_level = info
# 日志記錄滾動天數
log_max_days = 3
# frpc客戶端管理界面
admin_addr = 127.0.0.1
admin_port = 7400
admin_user = admin
admin_passwd = admin
# 連接池
pool_count = 5
# tcp數據流多路復用,默認開啟,服務端客戶端需要保持一致
tcp_mux = true
# 失敗重連
login_fail_exit = true
# 服務端與客戶端通信協議,支持tcp\upd
protocol = tcp
# dns服務選用
# dns_server = 8.8.8.8
#客戶端向服務端心跳檢查間隔與超時時間
heartbeat_interval = 10
heartbeat_timeout = 90
##############以上為客戶端服務的公共信息配置區域############

###############具體的穿透服務功能啟用(表示你要使用frp的那個功能)##############
[ssh]
#穿透類型
type = tcp
#需穿透服務本地訪問地址
local_ip = 127.0.0.1
#需穿透服務本地訪問端口
local_port = 22
#是否使用通訊加密,默認false
use_encryption = false
#是否使用通訊壓縮,默認false
use_compression = false
#穿透后外網訪問端口。
remote_port = 6001

[dns]
type = udp
local_ip = 114.114.114.114
local_port = 53
remote_port = 6002
use_encryption = false
use_compression = false

#http或者https模式主要針對於虛擬主機,訪問的取決於frps.ini文件中的vhost_http_port設置
[web01]
type = http
local_ip = 127.0.0.1
local_port = 80
use_encryption = false
use_compression = true
#虛擬主機訪問賬戶密碼設置,如果不設置的話。自己通過地址即可訪問。
http_user = admin
http_pwd = admin
# if domain for frps is frps.com, then you can access [web01] proxy by URL http://test.frps.com
#如果你的frps域名是yourdomain.com,那么你可以通過web01.yourdomain.com 來訪問web01這個穿透服務。
subdomain = web01
#自己定義域名
custom_domains = yourdomain.com
# locations is only available for http type
locations = /,/pic
# http重定向地址
host_header_rewrite = example.com
# http請求文件頭
header_X-From-Where = frp

[web02]
type = https
local_ip = 127.0.0.1
local_port = 8000
use_encryption = false
use_compression = false
subdomain = web02
custom_domains = web02.yourdomain.com

[plugin_static_file]
type = tcp
remote_port = 6006
plugin = static_file
plugin_local_path = /var/www/blog
plugin_strip_prefix = static
plugin_http_user = abc
plugin_http_passwd = abc


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM