10分钟,0经费让你的网站告别黑洞

做网站,被打已经是家常便饭了,可是每次被打,无防的阿里云、腾讯云的最低级的VPS一碰就死,几乎没有挣扎的余地,但是我们可以通过GitHub、Coding等等HTML托管服务(Pages服务)来让你的网站有一个全量镜像。

成品效果

感谢夜杏提供HTML单页

[hide]
[btn url=”https://mir.2890.ltd”]我的镜像传送门[/btn]
[/hide]
[hide]

[/hide]
[hide] [/hide]

现在存在的问题

  1. 不支持Pio插件
  2. 不支持Mirages的PJAX
  3. 不支持Typecho原生评论(废话)

如何制作

使用之前请粗略的了解Git的使用方法,本人只讲原理,不贴图(懒)
首先,注册一个GitHub或Coding账户,开一个新的Repo(GItHub命名请命名为Yourname.github.io)
使用SSH keygen创建一个新的ssh公钥,上传到Coding或者Github
然后使用crontab制作一个计划任务,ssh脚本为
[hide]
crontab用脚本

rm -rf /www/wwwroot/网站目录/网址/*
cd /www/wwwroot/网站目录
wget -r -p -np -k 网址
sudo sh /www/wwwroot/wdnmd.sh

[/hide]
[hide]
wdnmd.sh

cd /www/wwwroot/网站目录
git config --global credential.helper store
git config --global user.email "Email"
git config --global user.name "Your name"
git add .
git commit -m "update"
git push origin master

[/hide]
使用代码之前请在你的网站目录初始化Git
使用git init,然后 git remote add origin Git 仓库ssh地址然后git pull origin master拉取一次远程仓库,然后就可以执行脚本了。
执行脚本后,你的网站就会被部署到Coding或Github上(Coding需要使用DevOps仓库并且在部署中打开静态Pages)

暂无评论

发送评论 编辑评论

|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇