Go’s official module proxy server is blocked by GFW, so it can’t be used properly in China without VPN. However, this can be solved by setting a proxy server, and this article will list some available Go proxy servers. The same applies to the Hugo modules.
Proxy Servers
Proxy Server | URL |
---|---|
GOPROXY.CN (Qiniu Cloud) | https://goproxy.cn/ |
GOPROXY.IO | https://goproxy.io/ |
Alibaba Cloud (Aliyun) | https://mirrors.aliyun.com/goproxy/ |
Tencent Cloud | https://mirrors.tencent.com/go/ |
Setting Go Proxy Server
1go env -w GOPROXY=https://goproxy.cn/,direct
1export GOPROXY=https://goproxy.cn/,direct
1$ENV:GOPROXY="https://goproxy.cn/,direct"
Setting Hugo Modules Proxy Server
Unlike Go, Hugo uses the HUGO_MODULE_PROXY
environment variable instead of GOPROXY
.
hugo.yaml
1module:
2 proxy: https://goproxy.cn,direct
hugo.toml
1[module]
2 proxy = 'https://goproxy.cn,direct'
hugo.json
1{
2 "module": {
3 "proxy": "https://goproxy.cn,direct"
4 }
5}
1export HUGO_MODULE_PROXY=https://goproxy.cn/,direct
1$ENV:HUGO_MODULE_PROXY="https://goproxy.cn/,direct"
Read more on Module Config.