我想将 git.example.com 代理到 example.com:3000 以供 gitea 使用。我还想在子域上启用 https。
这是我的配置:
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName git.example.com
ServerAlias www.git.example.com
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLProxyEngine On
ProxyPreserveHost On
ProxyRequests off
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
AllowEncodedSlashes NoDecode
ProxyPass /git https://localhost:3000/ nocanon
ProxyPassReverse /git https://localhost:3000/
</VirtualHost>
当我重新启动 apache 并访问我的网站时,git.example.com 不会转到端口 3000,而是转到主网站,并且任何链接都会重定向到错误:
Proxy Error
The proxy server could not handle the request
Reason: Error during SSL Handshake with remote server
Apache/2.4.38 (OS) Server at git.example.com Port 443
主域现在转到端口 3000。我该如何解决这个问题?