前文
请记住,除非在无法访问jsDelivr
的情况下,不推荐自行搭建jsDelivr
反代
并注意配置反盗链!
安装宝塔面板
获取获取安装命令
此处的安装命令均为宝塔面板8.0.2安装
debian yum install -y wget && wget -O install.sh https://download.bt.cn/install/install_6.0.sh && sh install.sh ed8484bec
Ubuntu/Deepin wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh ed8484bec
Debian wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh ed8484bec
万能安装脚本 if [ -f /usr/bin/curl ];then curl -sSO https://download.bt.cn/install/install_panel.sh;else wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh;fi;bash install_panel.sh ed8484bec
国产龙芯架构 wget -O install_panel.sh https://download.bt.cn/install/0/loongarch64/loongarch64_install_panel.sh && bash install_panel.sh ed8484bec
开始安装面板
(本文以Putty
为例)
运行Putty
主界面如下
在Host Name
输入服务器ip地址
点击Putty
左下角Open
连接后会有安全提醒
点击Accept
在login as
后输入你的Linux用户名
接着输入密码
在光标处输入安装命令
使用宝塔
等待2分钟左右
命令行会输出面板的登录信息
使用输出的ip+端口/安全登录入口访问
输入输出的账号密码
点击登录
稍后会要求阅读使用协议
阅读完成后,点击我以阅读宝塔面板使用协议
然后绑定手机号
宝塔强制要求,如不行绑定可自行百度或者安装aaPanel(国外的宝塔面板)
安装环境
安装推荐即可
安装完成后点击网站
点击新建
输入域名
点击右下角完成
点击编辑
网站配置
输入以下代码
server {
listen 80;
listen 443 ssl http2;
# 请更改为你的证书路径
ssl_certificate certs/default.cer;
ssl_certificate_key certs/default.key;
# 请更改为你的镜像域名
server_name jsd.rehiy.com;
location / {
proxy_pass https://cdn.jsdelivr.net;
proxy_set_header Host $proxy_host;
proxy_set_header Accept-Encoding '';
proxy_ssl_server_name on;
proxy_ssl_name $proxy_host;
proxy_redirect / /;
# Proxy Cache
proxy_cache jsdelivr;
proxy_cache_lock on;
proxy_cache_lock_timeout 15s;
proxy_cache_use_stale updating;
proxy_cache_background_update on;
proxy_cache_key $host$request_uri;
proxy_cache_valid 200 301 302 30d;
proxy_cache_valid 500 501 502 503 15s;
proxy_cache_valid any 5m;
# Replace Domain
sub_filter_once off;
sub_filter_types application/javascript application/json text/xml text/css;
sub_filter '$proxy_host' '$host';
}
}
proxy_cache_path / levels=1:2 use_temp_path=off keys_zone=jsdelivr:300m inactive=30d max_size=30g;
注意! 修改最后一行/www/wwwroot/
为宝塔面板的网站路径(即/www/wwwroot/域名
)
点击保存
使用
将cdn.jsdelivr.net
替换成你的域名即可使用
愉快的玩耍吧