前面的免责声明:作为一个整体,我对Linux/Ubuntu和系统管理都很陌生,只是在我的空闲时间才涉猎过它,所以请耐心和彻底地回答。
我用git-lfs在Ubuntu 20.04服务器上安装了Gitea,我让Apache运行反向代理来使用我的子域,我还用certbot配置了SSH。
每次我尝试推送一个大文件(~〉1Gb)时,我都会得到一个LFS:来自HTTP 413的客户端错误。
目前为止我尝试的方法是:
- 禁用UFW
- 在gitea config中增加所有相关的文件和文件大小选项
下面是我的应用程序.ini:
APP_NAME = Tali Git
RUN_USER = git
RUN_MODE = prod
[security]
INTERNAL_TOKEN = XXXXX
INSTALL_LOCK = true
SECRET_KEY = XXXXXXX
PASSWORD_HASH_ALGO = pbkdf2
[database]
DB_TYPE = sqlite3
HOST = 127.0.0.1:3306
NAME = gitea
USER = gitea
PASSWD =
SCHEMA =
SSL_MODE = disable
CHARSET = utf8
PATH = /var/lib/gitea/data/gitea.db
LOG_SQL = false
[repository]
ROOT = /var/lib/gitea/data/gitea-repositories
[repository.upload]
FILE_MAX_SIZE = 999999999999
MAX_FILES = 999999999999
[server]
SSH_DOMAIN = git.example.com
DOMAIN = git.example.com
HTTP_PORT = 3000
ROOT_URL = https://git.example.com/
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /var/lib/gitea/data/lfs
LFS_JWT_SECRET = XXXXXXXXXXXX
LFS_MAX_FILE_SIZE = 999999999999999999999999
OFFLINE_MODE = false
LFS_HTTP_AUTH_EXPIRY = 999999m
[mailer]
ENABLED = false
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = true
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.localhost
[picture]
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = true
[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true
[session]
PROVIDER = file
[log]
MODE = console
LEVEL = info
ROOT_PATH = /var/lib/gitea/log
ROUTER = console
[ui]
DEFAULT_THEME = arc-green
THEMES = gitea,arc-green
Apache HTTP代理:
<VirtualHost *:80>
ServerName git.example.com
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
LimitRequestBody 0
RewriteEngine on
RewriteCond %{SERVER_NAME} =git.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
apache SSH代理:
<IfModule mod_ssl.c>
<VirtualHost *:443>
<Directory />
SSLRenegBufferSize 2147483647
</Directory>
ServerName git.example.com
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
SSLCertificateFile /etc/letsencrypt/live/git.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/git.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
在Apache访问或错误日志中没有什么突出的内容。
包含日志级别跟踪的相关Gitea日志可在此处找到:https://pastebin.com/XgbQaZn0
任何建议、想法或分享经验都将不胜感激。我在这里完全不知所措。
3条答案
按热度按时间olhwl3o21#
你有没有试过
在你的git配置中?
9q78igpj2#
好吧,我想出来了,并张贴在这里,任何人都遇到在未来:
我把我的apache配置合并到一个文件中,因为certbots自动配置器实际上创建了一个专用的443配置文件。
之前,我运行
certbot certonly
生成了这些证书文件,我将Apache指向这些文件。此外(我还没有测试这是否会影响它),这次我在
app.ini
配置的gitea
根URL中使用http://
,而不是https://
。不管怎么样,它起作用了!
vom3gejh3#
Cloudflare将导致HTTP 413错误时,push较大的文件到LFS。请确保运行Gitea没有Cloudflare作为代理。