我正在尝试设置 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
这是我在端口 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 作为 root 来重定向某些端口)提前致谢