我正在尝试将 gitea 设置为将 https 与我从letsencrypt 以普通用户身份运行服务获得的证书一起使用。
我已经使用普通用户在端口 80 上使用 httpgit
并使用 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
这是我在端口 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
使用此配置,我可以访问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 作为根来重定向某些端口)提前致谢