I am hosting Gitlab on digital ocean and I have setup Gitlab to use Apache. When I create a VirtualHost for gitlab I get SSL. It works when VirtualHost is set to <VirtualHost *:80> but then when I change it to my domain I get an error in chrome saying ERR_SSL_PROTOCOL_ERROR. Below is my configuration, I don't understand why it doesn't work. I'm no expert in Apache and this is the configuration that I got on the Gitlab website for 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 example.com:443>
  SSLEngine on
  SSLHonorCipherOrder on
  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://example.com

  RewriteEngine on
  RewriteCond %{REQUEST_URI} ^/uploads/.*
  RewriteRule .*{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

I want to set multiple sites up on the same server and I only want to get to my gitlab server with a certain domain, which is why I am setting this up in Apache


Did you copy your certs to the /etc/gitlab/ssl folder? After that you can run gitlab-ctl reconfigure and then gitlab-ctl restart. I’m not sure if it will work with your setup (apache) but you could try that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.