完美解決github訪問速度慢和圖片不顯示問題

解決訪問慢問題

1. 修改本地hosts文件

windows系統(tǒng)的hosts文件的位置如下:C:\Windows\System32\drivers\etc\hosts
mac/linux系統(tǒng)的hosts文件的位置如下:/etc/hosts

2. 增加http://github.global.ssl.fastly.nethttp://github.com的映射

獲取Github相關(guān)網(wǎng)站的ip
訪問https://www.ipaddress.com,拉下來,找到頁面中下方的“IP Address Tools – Quick Links”
分別輸入github.global.ssl.fastly.net和github.com,查詢ip地址
下面是我的配置
140.82.114.4    github.com
199.232.5.194   github.global.ssl.fastly.net

3.命令提示符中輸入ping github.com

image

<figcaption style="margin-top: 0.66667em; padding: 0px 1em; font-size: 0.9em; line-height: 1.5; text-align: center; color: rgb(153, 153, 153);">配置前</figcaption>

image

<figcaption style="margin-top: 0.66667em; padding: 0px 1em; font-size: 0.9em; line-height: 1.5; text-align: center; color: rgb(153, 153, 153);">配置后</figcaption>

再次訪問流量器https://github.com/,秒出

image

解決圖片不顯示問題

圖片不顯示,很大可能是github的CDN域名被污染問題。所以可以嘗試使用本地hosts文件對網(wǎng)站進(jìn)行域名解析。

一般的DNS問題都可以通過修改hosts文件 將域名解析直接指向IP地址來繞過DNS的解析,以此解決污染問題。

打開github任意未顯示圖片的網(wǎng)頁,復(fù)制圖片的地址。
比如https://github.com/serenader2014/flutter_carousel_slider/blob/master/screenshot/basic.gif

image.png

打開https://www.ipaddress.com/搜索上面的網(wǎng)址

image.png

host的格式如下,前面是IP后面是域名,經(jīng)過整理,下面對于GitHub的IP直接復(fù)制粘貼即可

# GitHub Start 
140.82.113.3      github.com
140.82.114.20     gist.github.com

151.101.184.133    assets-cdn.github.com
151.101.184.133    raw.githubusercontent.com
199.232.28.133     raw.githubusercontent.com 
151.101.184.133    gist.githubusercontent.com
151.101.184.133    cloud.githubusercontent.com
151.101.184.133    camo.githubusercontent.com
199.232.96.133     avatars.githubusercontent.com
151.101.184.133    avatars0.githubusercontent.com
199.232.68.133     avatars0.githubusercontent.com
199.232.28.133     avatars0.githubusercontent.com 
199.232.28.133     avatars1.githubusercontent.com
151.101.184.133    avatars1.githubusercontent.com
151.101.108.133    avatars1.githubusercontent.com
151.101.184.133    avatars2.githubusercontent.com
199.232.28.133     avatars2.githubusercontent.com
151.101.184.133    avatars3.githubusercontent.com
199.232.68.133     avatars3.githubusercontent.com
151.101.184.133    avatars4.githubusercontent.com
199.232.68.133     avatars4.githubusercontent.com
151.101.184.133    avatars5.githubusercontent.com
199.232.68.133     avatars5.githubusercontent.com
151.101.184.133    avatars6.githubusercontent.com
199.232.68.133     avatars6.githubusercontent.com
151.101.184.133    avatars7.githubusercontent.com
199.232.68.133     avatars7.githubusercontent.com
151.101.184.133    avatars8.githubusercontent.com
199.232.68.133     avatars8.githubusercontent.com
199.232.96.133     avatars9.githubusercontent.com

# GitHub End

通過修改hosts文件訪問medium

打開hosts文件(C:\Windows\System32\drivers\etc\hosts),向其中添加:

# Medium Start
104.16.120.127  medium.com
104.16.120.145  api.medium.com
104.16.120.145  cdn-static-1.medium.com
104.16.120.145  cdn-images-1.medium.com
104.16.120.145  cdn-images-2.medium.com
# Medium End 

再在命令提示符中輸入: ipconfig /flushdns,更新ip

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容