将许多 CDN 链接转换为本地文件的最简单方法
我想将一个开源网站部署到我的局域网中。
问题是这个网站的代码中有大量的CDN链接,如下所示:
3590 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
3591 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
3592 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" />
3593 <?php if (FM_USE_HIGHLIGHTJS): ?>
3594 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/styles/<?php echo FM_HIGHLIGHTJS_STYLE ?>. min.css">
这些CDN链接无法访问,因为我在局域网中。
我想到的一种解决方案是将它们全部下载到本地机器,并将CDN的所有链接修改为本地文件。
但CND链接太多,所以放弃了。
有没有不需要改代码的?例如,在HTTP服务器中cahce这些文件(但我不知道该怎么做,我正在使用Apache)?
I want to deploy an open source website to my local area network.
The problem is that there are tons of CDN links in the code of this website, like the following:
3590 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
3591 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
3592 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" />
3593 <?php if (FM_USE_HIGHLIGHTJS): ?>
3594 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/styles/<?php echo FM_HIGHLIGHTJS_STYLE ?>. min.css">
These CDN links can't be accessed because I'm in a local area network.
One solution I thought up is to download all of them to local machine, and modify all links of CDN to local files.
But there are too many CND links, so I gave up.
Is there anyway that doesn't need to change the code? For example, cahce these files in HTTP server(But I don't know how to do, I'm using Apache)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论