阿里云CDN使用

geteshi
2024-11-29 / 0 评论 / 22 阅读 / 正在检测是否收录...

1. 阿里云配置一个cdn,一切默认就行

新建一个cdn,域名就是,泛域名类型的

.cdn.example.com

源站,因为家里的80和443是没了的,所以使用的是65000,例如:

test.example.com:65000

1.1 基本设置-->ipv6开关

可以根据自己的需求设置是否打开

1.2 回源配置-->IPv6回源

优先使用IPv6-->已开启
回源跟随-->未开启
回源IPv4/IPv6轮询-->已开启
image-20241129095837717

1.3 性能优化-->忽略参数

这里需要修改一下,要不然某些参数会被忽略
忽略参数-->否
image-20241129100634220

2. 新建一个网站

默认就行,监听的端口是65000,不是默认的80,配置一个反向代理
反代到frps的端口号,比如65080

3. 对应的服务器上配置frp

3.1 frps的配置

bindAddr = "0.0.0.0"
# 服务端监听端口
bindPort = 52101
# 服务端监听 KCP 协议端口,用于接收配置了使用 KCP 协议的 frpc 连接。
kcpBindPort = 52101

# 在 method 为 token 时生效,客户端需要设置一样的值才能鉴权通过。
auth.token = "token.example"
# http端口,不要设置80,否则和宝塔面板的端口号冲突
vhostHTTPPort = 65080
# https端口,不要设置443
vhostHTTPSPort = 65443
# 二级域名后缀
subDomainHost = "cdn.example.com"

# 开启frps仪表盘可以检查frp的状态和代理的统计信息。
webServer.addr = "0.0.0.0"
webServer.port = 65002
webServer.user = "example"
webServer.password = "example"

enablePrometheus = true

# 日志配置文件
# 日志文件,不指定日志信息默认输出到控制台
log.to = "./logs/cdn-example.log"
# 日志等级,可用等级“trace,debug,info,warn,error”
log.level = "info"
# 日志保存最大时间
log.maxDays = 3

log.disablePrintColor = false


# 自定义默认的404页面
custom404Page = "./frp/404.html"

3.2 frpc的配置

# 用户名,设置此参数后,代理名称会被修改为 {user}.{proxyName},避免代理名称和其他用户冲突。
user = "daimaji"

serverAddr = "127.0.0.1"
serverPort = 52101

# 登录失败就退出
loginFailExit = true

# 控制台日志文件
log.to = "./cdn-example.log"
# trace, debug, info, warn, error
log.level = "info"
log.maxDays = 3
# 当log.to是控制台时禁用日志颜色,默认值为false
log.disablePrintColor = false

# 认证方式
auth.method = "token"
# 令牌
auth.token = "token.example"

# 控制面板设置
webServer.addr = "0.0.0.0"
webServer.port = 65002
webServer.user = "example"
webServer.password = "example"

# 将提前建立连接,默认值为零
transport.poolCount = 5

#用于连接到服务器的通信协议
#现在支持tcp、kcp、quic、websocket和wss,默认为tcp
transport.protocol = "tcp"

#连接服务器时设置客户端绑定ip,默认为空。
#只有当protocol=tcp或websocket时,才会使用该值。
transport.connectServerLocalIP = "0.0.0.0"

[[proxies]]
name = "测试"
type = "http"
localIP = "127.0.0.1"
localPort = 65003
subdomain = "test"

4. 访问测试

0

评论 (0)

取消