gogs上传大文件报错error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
解决方法:
第一种情况:使用了nginx类工具做了反向代理
1、这里以nginx为例,修改nginx的配置文件
server {
listen 80; # nginx配置的端口,如果80或者443端口没有打开,可以配置成其他端口
server_name localhost; # 域名
# 增加或修改这一行
client_max_body_size 1g;
location / {
proxy_pass http://127.0.0.1:端口号; # 既然是做反向代理,一般这里写127即可,端口为gogs的http端口
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# 其他配置...
}
2、修改gogs的配置文件,一般位于/path/gogs/custom/conf/app.ini
[repository]
REPO_MAX_SIZE = 1073741824 # 1GB in bytes