-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcdn.jsdmirror.com.dir.nginx.conf
72 lines (53 loc) · 9.52 KB
/
cdn.jsdmirror.com.dir.nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#PROXY-START/
location ~* ^/(npm|gh|wp|china|combine)/([^/]+/?)+
{
# 启用代理缓冲区选项
proxy_buffering on;
# 设置代理缓冲区大小
proxy_buffer_size 128k;
proxy_buffers 64 128k;
proxy_busy_buffers_size 2048k;
proxy_max_temp_file_size 1024m;
# 启用 TCP nodelay 选项
tcp_nodelay on;
# 代理到目标服务器
proxy_pass https://fastly.jsdelivr.net;
# 设置代理请求头
proxy_set_header Host fastly.jsdelivr.net;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_http_version 1.1;
# 设置 SSL 名称和服务器名称指示
proxy_ssl_name fastly.jsdelivr.net;
proxy_ssl_server_name on;
# 忽略 Accept-Encoding 头
proxy_set_header Accept-Encoding "";
# 替换响应内容中的文本
sub_filter "Learn more about jsDelivr" " Learn more about JSDMirror";
sub_filter "<text .*?>jsDelivr</text>" "<text jsDelivr>JSDMirror</text>";
sub_filter "<text x=\"265\" y=\"140\" transform=\"scale(.1)\" fill=\"#fff\" textLength=\"410\">jsDelivr</text>" "<text x=\"265\" y=\"140\" transform=\"scale(.1)\" fill=\"#fff\" textLength=\"410\">JSDMirror</text>";
sub_filter " <svg class=\"logo\" viewBox=\"0 0 140 34\" xmlns=\"http://www.w3.org/2000/svg\">\n <g fill=\"#1e3b45\">\n <path\n d=\"m43.616 19.576c0 4.005-1.389 6.008-4.168 6.008-.432 0-.853-.059-1.261-.174v-1.112c.455.154.883.232 1.285.232 1.065 0 1.833-.404 2.304-1.209.471-.807.706-2.063.706-3.769v-10.859h1.134z\"/>\n <path\n d=\"m47.065 24.705v-1.309c1.188.756 2.393 1.135 3.612 1.135 1.296 0 2.28-.268 2.952-.805.671-.537 1.007-1.288 1.007-2.251 0-.85-.226-1.528-.678-2.032-.451-.506-1.429-1.194-2.935-2.067-1.682-.979-2.747-1.799-3.195-2.46-.447-.66-.671-1.422-.671-2.286 0-1.172.455-2.169 1.366-2.988.911-.817 2.126-1.227 3.647-1.227.988 0 1.975.166 2.963.498v1.204c-.972-.44-2.011-.66-3.113-.66-1.127 0-2.02.287-2.681.858-.659.571-.99 1.297-.99 2.177 0 .848.226 1.524.677 2.026.452.5 1.426 1.184 2.923 2.048 1.551.881 2.584 1.663 3.097 2.345.514.684.77 1.469.77 2.356 0 1.274-.442 2.311-1.325 3.114-.884.803-2.133 1.204-3.746 1.204-.572 0-1.229-.09-1.973-.266-.745-.178-1.313-.383-1.707-.614z\"/>\n <path\n d=\"m59.104 25.295v-16.602h5.881c5.895 0 8.844 2.698 8.844 8.093 0 2.585-.805 4.65-2.413 6.194-1.61 1.543-3.753 2.315-6.431 2.315zm3.74-13.556v10.522h1.852c1.621 0 2.892-.485 3.814-1.458s1.383-2.296 1.383-3.97c0-1.583-.457-2.827-1.372-3.734-.914-.907-2.199-1.36-3.85-1.36z\"/>\n <path\n d=\"m86.841 25.295h-9.957v-16.602h9.574v3.046h-5.834v3.693h5.43v3.032h-5.43v3.796h6.217z\"/>\n <path d=\"m99.893 25.295h-9.887v-16.602h3.74v13.568h6.147z\"/>\n <path d=\"m105.989 8.693v16.602h-3.74v-16.602z\"/>\n <path\n d=\"m123.834 8.693-5.719 16.602h-4.236l-5.651-16.602h4.029l3.462 11.553c.186.625.297 1.178.336 1.657h.068c.055-.518.174-1.084.36-1.702l3.439-11.508z\"/>\n <path\n d=\"m140 25.295h-4.295l-2.581-4.273c-.193-.322-.379-.613-.555-.868-.178-.254-.358-.473-.539-.654-.182-.18-.369-.321-.567-.416-.197-.096-.41-.145-.643-.145h-1.006v6.356h-3.74v-16.602h5.926c4.029 0 6.043 1.506 6.043 4.515 0 .578-.088 1.114-.266 1.604s-.428.932-.752 1.325c-.324.395-.717.733-1.176 1.02-.459.285-.969.508-1.534.67v.047c.248.076.486.203.719.375.231.174.455.377.67.61.217.231.424.479.619.746.197.266.377.526.539.782zm-10.185-13.8v4.619h1.62c.803 0 1.448-.231 1.932-.694.494-.471.742-1.053.742-1.749 0-1.45-.87-2.177-2.605-2.177h-1.689z\"/>\n </g>\n <path d=\"m15.386.338-3.106 11.038v.104 11.039l3.106 11.143 3.194-11.143v-11.039-.104z\"\n fill=\"#bd483b\"/>\n <path d=\"m15.386.338-15.386 5.542 2.186 20.492 13.2 7.29\" fill=\"#e64e3d\"/>\n <path d=\"m15.386 33.662 13.268-7.365 2.483-20.49-15.751-5.469\" fill=\"#bd483b\"/>\n <path\n d=\"m12.594 25.088c-1.514-.473-2.864-1.317-3.94-2.431l-.003-.002c-.131-.137-.257-.274-.381-.418-.838-.979-1.478-2.13-1.857-3.396.251.233.518.447.796.647.003.008.008.016.011.027-.003-.012-.008-.02-.011-.027.398.279.822.526 1.269.737.141.064.282.125.427.186.177.07.36.135.542.195.011.006.024.006.035.01.032.012.065.023.097.033.074.756.649 1.372 1.39 1.504.287 1.157.833 2.146 1.625 2.935z\"\n fill=\"#fec82f\"/>\n <path\n d=\"m13.174 11.794c0 .324.088.627.243.883-1.25 1.753-2.108 3.656-2.479 5.539-.041.209-.077.416-.105.619-.429.113-.79.393-1.016.762-.013 0-.024-.004-.035-.01-.023-.006-.04-.014-.061-.021-.142-.045-.281-.098-.417-.152-.204-.08-.403-.174-.598-.272-.663-.338-1.26-.772-1.781-1.291-.11-.111-.213-.219-.311-.332l-.041-.049c-.038-.045-.078-.092-.115-.137-.017-.021-.032-.039-.047-.059-.014-.018-.024-.031-.037-.045-.005-.01-.013-.016-.017-.023-.02-.022-.037-.047-.053-.068-.008-.012-.017-.022-.023-.029-.001-.004-.002-.004-.004-.008-.013-.014-.024-.033-.037-.049-.055-.072-.107-.149-.157-.225-.009-.012-.019-.024-.025-.039-.006-.006-.015-.018-.02-.027-.014-.203-.02-.408-.02-.617 0-1.882.557-3.636 1.512-5.105.113-.176.235-.348.361-.514.12-.16.245-.319.374-.467 1.126-1.317 2.61-2.315 4.299-2.847.026.182.059.367.095.553.192.967.513 1.942.949 2.898-.271.3-.434.698-.434 1.132z\"\n fill=\"#fec82f\"/>" "<img src=\"https://img.cuteapi.com/2023/08/29/Background.png\" width=\"120\" height=\"40\" alt=\"Background Image\">";
sub_filter "<path\n d=\"m12.176 20.479c0 .221-.079.424-.212.58-.029.037-.061.068-.096.1-.161.141-.368.225-.596.225-.173 0-.335-.049-.472-.135-.147-.09-.265-.219-.342-.375-.058-.121-.089-.252-.089-.395 0-.26.11-.494.286-.658.029-.027.06-.051.091-.074.148-.107.331-.17.526-.17.206 0 .395.068.546.186.085.063.155.139.213.229.094.137.145.307.145.487z\"\n fill=\"#fec82f\"/>\n <path\n d=\"m15.777 11.794c0 .147-.032.281-.094.403-.148.299-.456.502-.808.502-.044 0-.087-.002-.128-.006-.008-.004-.016-.004-.025-.006-.383-.066-.684-.369-.741-.756-.007-.043-.01-.09-.01-.137 0-.102.017-.201.05-.295.123-.354.46-.606.854-.606h.002.036c.392.018.72.285.827.645.025.082.037.168.037.256z\"\n fill=\"#fec82f\"/>\n <path\n d=\"m24.752 16.143c0 .907-.129 1.782-.368 2.61-.799-.211-1.606-.52-2.4-.914.022-.109.033-.221.033-.336 0-.225-.044-.442-.125-.639.031-.029.064-.061.095-.094.957-.977 1.763-2.055 2.404-3.212.234.821.361 1.69.361 2.585z\"\n fill=\"#df9c26\"/>\n <path\n d=\"m23.881 12.196c-.063.139-.131.277-.201.416-.627 1.235-1.455 2.382-2.459 3.407-.009.01-.02.02-.028.027-.255-.156-.557-.244-.879-.244-.375 0-.722.123-1.004.328-.514-.404-1.011-.848-1.49-1.327-.608-.604-1.157-1.247-1.647-1.909.252-.297.405-.68.405-1.102 0-.313-.087-.61-.237-.862 1.21-1.163 2.547-2.106 3.917-2.788 1.572.961 2.841 2.372 3.623 4.054z\"\n fill=\"#df9c26\"/>\n <path\n d=\"m21.217 17.503c0 .379-.23.701-.556.836-.108.045-.225.07-.348.07-.063 0-.125-.008-.185-.02-.385-.082-.681-.408-.715-.805.011-.01.021-.016.028-.022-.01-.008-.021-.014-.03-.023-.001-.012-.001-.022-.001-.037 0-.389.25-.723.601-.85.095-.033.196-.053.302-.053.09 0 .179.014.262.039.346.105.606.412.64.785.002.027.002.055.002.08z\"\n fill=\"#df9c26\"/>\n <path\n d=\"m21.452 18.767c-.301.274-.7.44-1.139.44-.351 0-.677-.107-.949-.289-.039.025-.078.051-.115.072-1.233.781-2.538 1.352-3.864 1.698v4.824c3.887 0 7.222-2.37 8.64-5.744-.859-.237-1.723-.573-2.573-1.001z\"\n fill=\"#df9c26\"/>\n <path\n d=\"m15.386 20.688c-.793.205-1.591.33-2.385.367-.042.002-.086.006-.128.008-.151.41-.454.744-.839.94.245.909.688 1.698 1.319 2.327.524.524 1.162.92 1.891 1.18.046 0 .093.002.142.002z\"\n fill=\"#fec82f\"/>\n <path\n d=\"m18.612 17.503c0-.172.026-.34.074-.498-.562-.44-1.106-.92-1.625-1.442-.614-.614-1.172-1.262-1.675-1.934v5.946c1.124-.324 2.235-.823 3.291-1.489.009-.006.02-.014.03-.022-.061-.174-.095-.364-.095-.561z\"\n fill=\"#df9c26\"/>\n <path\n d=\"m15.386 13.629c-.045-.059-.091-.113-.132-.174-.123.029-.249.043-.378.043-.227 0-.441-.045-.637-.123-1.134 1.606-1.912 3.341-2.25 5.049-.032.162-.059.32-.083.475.477.195.848.596.996 1.092.016-.004.029-.004.046-.004.809-.039 1.627-.18 2.438-.412z\"\n fill=\"#fec82f\"/>\n <path\n d=\"m15.386 6.778v3.394c.048.016.098.033.145.055 1.106-1.073 2.316-1.979 3.573-2.681-1.14-.496-2.399-.768-3.718-.768z\"\n fill=\"#df9c26\"/>\n <path\n d=\"m15.386 6.778c-.608 0-1.201.055-1.773.168.025.197.06.404.101.606.168.86.449 1.725.829 2.575.106-.02.219-.033.333-.033.178 0 .347.027.51.078z\"\n fill=\"#fec82f\"/>\n </svg>" "";
sub_filter "jsdelivr.com, 2012 - 2024" "jsdmirror.com<br>2021- 2024";
sub_filter '<a href="https://github.com/jsdelivr/jsdelivr">' '<a href="https://beian.miit.gov.cn">辽ICP备2023005487号-9 <a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=21028102000208">辽公网安备21028102000208号</a>  <a href="https://github.com/54ayao/jsdmirror"> ';
sub_filter "Documentation" "GitHub主页</a>   ";
sub_filter " Learn more about JSDMirror" "关于JSDMirror";
sub_filter "jsDelivr" "JSDmirror";
sub_filter "data.jsdelivr.com" "data.jsdmirror.com";
sub_filter "www.jsdelivr.com" "www.jsdmirror.com";
sub_filter "cdn.jsdelivr.net" "cdn.jsdmirror.com";
# 关闭 sub_filter_once,以便所有匹配的文本都会被替换
sub_filter_once off;
# 添加自定义响应头
add_header X-Cache $upstream_cache_status;
# 忽略某些响应头
proxy_ignore_headers Set-Cookie Cache-Control expires;
# 设置缓存
proxy_cache cache_one;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 304 301 302 120m;
}
#PROXY-END/