我在 digital ocean 上托管 Gitlab,并且已将 Gitlab 设置为使用 Apache。当我为 gitlab 创建 VirtualHost 时,我获得了 SSL。当 VirtualHost 设置为时,它可以工作,<VirtualHost *:80>
但是当我将其更改为我的域时,我在 chrome 中收到错误提示ERR_SSL_PROTOCOL_ERROR
。以下是我的配置,我不明白为什么它不起作用。我不是 Apache 专家,这是我在 Gitlab 网站上获得的 Apache 配置。
<VirtualHost example.com:80>
ServerName example.com
ServerSignature Off
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [NE,R,L]
</VirtualHost>
<VirtualHost example.com:443>
SSLEngine on
SSLHonorCipherOrder on
SSLCipherSuite "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS"
Header add Strict-Transport-Security: "max-age=15768000;includeSubdomains"
SSLCompression Off
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCACertificateFile /etc/letsencrypt/live/example.com/chain.pem
ServerName example.com
ServerSignature Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
<Location />
Require all granted
ProxyPassReverse http://127.0.0.1:8181
ProxyPassReverse http://example.com
</Location>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^/uploads/.*
RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]
RequestHeader set X_FORWARDED_PROTO 'https'
RequestHeader set X-Forwarded-Ssl on
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
</VirtualHost>
我想在同一台服务器上设置多个站点,并且只想通过某个域名访问我的 gitlab 服务器,这就是我在 Apache 中进行设置的原因
答案1
您是否已将证书复制到/etc/gitlab/ssl
文件夹?之后,您可以运行gitlab-ctl reconfigure
,然后gitlab-ctl restart
。我不确定它是否适用于您的设置(apache),但您可以尝试一下。