Vic*_*red 5 ssl https iptables gitea
我正在尝试设置 gitea 以使用 https 和我从 LetsEncrypt 获得的证书,以普通用户身份运行该服务。
我已经让它与普通用户在端口 80 上使用 http 一起工作git
,并使用 iptables 将端口 80 重定向到端口 3000。
另外,我已经在端口 3000 上使用 https 重定向到端口 3080。
但我不知道如何配置它(也许与 iptables 一起),以便对端口 80 的请求重定向到适当的端口(3000?3080?)。
我以 root 身份使用以下 iptables 命令将端口 80 重定向到端口 3000:
# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000
这是我的 HTTP 配置的相关部分
RUN_USER = git
LOCAL_ROOT_URL = http://localhost:3000/
DOMAIN = example
HTTP_PORT = 80
ROOT_URL = http://example.com
Run Code Online (Sandbox Code Playgroud)
这是我在端口 3000 上重定向到端口 3080 的 HTTP 配置
RUN_USER = git
PROTOCOL = https
LOCAL_ROOT_URL = https://localhost:3000/
DOMAIN = example.com
HTTP_PORT = 3000
REDIRECT_OTHER_PORT = true
PORT_TO_REDIRECT = 3080
ROOT_URL = https://example.com
CERT_FILE = /etc/letsencrypt/live/example.com/fullchain.pem
KEY_FILE = /etc/letsencrypt/live/example.com/privkey.pem
Run Code Online (Sandbox Code Playgroud)
通过此配置,我可以访问https://example.com:3000
并且工作正常,但是如果我访问,https://example.com:3080
我会得到一个Secure Connection Failed
with Error code: SSL_ERROR_RX_RECORD_TOO_LONG
.
我尝试使用 iptables 将端口 80 重定向到端口 3080,但没有成功。
你能帮我设置一下,以便我可以在端口 80 上以普通用户身份运行该服务,以便人们可以访问它吗https://example.com
?(也许事先使用 iptables 作为 root 来重定向某些端口)提前致谢
HTTPS 的端口是 443。大多数人会使用反向代理而不是 iptables 来解决这个问题。
Gitea 可以自己处理 LetsEncrypt。就是这样:
[server]
PROTOCOL=https
DOMAIN=git.example.com
ENABLE_LETSENCRYPT=true
LETSENCRYPT_ACCEPTTOS=true
LETSENCRYPT_DIRECTORY=https
LETSENCRYPT_EMAIL=email@example.com
Run Code Online (Sandbox Code Playgroud)
摘自:https: //docs.gitea.io/en-us/https-setup/
归档时间: |
|
查看次数: |
7706 次 |
最近记录: |