Loading... 我的网站里用的是GitHub当图床,虽然已经使用cdn加速了,但有时候还是无法显示图片(用的 jsdelivr,但好像也。同时我发现我也无法直连GitHub,以前配置的host也已经失效了,现在重新进行配置。 首先可以使用[ping工具](https://ping.chinaz.com/github.com)得到github.com的服务器ip ![2022-11-26T12:56:17.png][1] 经过自己在命令提示符ping+ip之后,得到了两个可以正常访问的ip,于是将他们加入hosts文件中 ![2022-11-26T12:56:32.png][2] ``` C:\Windows\System32\drivers\etc ``` 在这个目录下,打开hosts文件,写入以下配置 ``` #update 2022/11/26 #github 140.82.121.3 github.com 185.199.108.133 raw.githubusercontent.com ``` 你也可以自己尝试,哪个ip可以ping通,就在hosts文件中加入这个ip,后面写github.com,就可以在访问github.com时,转而访问这个ip了。 ``` ping 140.82.121.3 ipconfig /flushdns ``` ![2022-11-26T12:56:59.png][3] 原理就是我们在访问github.com时,会先在本机的hosts文件中找有没有对应的ip,如果有就访问这个ip(所以这里一定要放你自己可以ping通的ip)。如果本机中没有就会去dns服务器中找,然而dns服务器中找到的ip不一定能访问成功,所以这种情况下就要自己手动配置一个可以访问的ip。 后续: 感觉用别人的图床始终还是不太稳定,趁现在文章写得少,赶紧把图片传到自己服务器上了。。。 不过对于github上不去的问题还是可以参考一下的 [1]: https://artrajz.cn/usr/uploads/2022/11/2555900924.png [2]: https://artrajz.cn/usr/uploads/2022/11/2057697937.png [3]: https://artrajz.cn/usr/uploads/2022/11/3204542187.png Last modification:November 26, 2022 © Allow specification reprint Support Appreciate the author WeChat Like 1 如果觉得我的文章对你有用,请随意赞赏