体验使用 Apache 作为代理的乐趣。太棒了。虽然需要学习,但回报是值得的!
我采用了虚拟主机方法,无论是本地访问还是外部访问,都可以使用相同的 URL。一切都已设置好,apache mod_proxy 正在监听端口 443,将所有 gitlab.mydomain 流量重定向到基于局域网的 lamp 堆栈,一切顺利除了当我被重定向到首页时http://gitlab.mydomain/users/sign_in。我必须手动重新输入 URL 中的 https,然后一切正常。当我在项目页面上发表评论时也是如此。对于登录问题,应用程序 (GitLab)似乎将匿名未登录用户重定向到http://gitlab.mydomain.com而不是预期的https://gitlab.mydomain.com。
我明天可能得深入研究代码,看看它是否在应用程序级别,即$base_url类似于 Drupal 中的某种变量。这是 vhost 文件,也许我遗漏了或者破坏了其中的某些内容,欢迎提供任何提示。
############################################################
#
# proxy related directives
#
###########################################################
#NameVirtualHost gitlab.mydomain.com:443
<VirtualHost *:443>
ServerName gitlab.mydomain.com
ProxyRequests off
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
CustomLog logs/gitlab_log combined
LogLevel info
SSLProxyEngine On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
SSLEngine on
SSLProtocol all
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
# SSLProtocol all -SSLv2
# SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
ProxyPass / https://gitlab.mydomain.com/
ProxyPassReverse / https://gitlab.mydomain.com/
</VirtualHost>
刚刚看到 NameVirtualHost 被评论了?!?这不需要吗?不管怎样,一切都完成了 95%,但注册页面有点烦人。
有足够声誉来编辑标签的人可以将 gitlab 标签添加到帖子中吗?
答案1
问题已在应用程序端得到解决。在 gitlab 配置文件中,需要指明协议是 https。