Gitlab enables https

Source: Internet
Author: User

In fact, gitlab is only responsible for listening to local socket files, while the Web server uses nginx and so on. You only need to make the appropriate configuration on the Web server.

The following is an example using nginx. The gitlab script file downloaded in the gitlab Installation Guide is modified as appropriate.

# GITLAB# Maintainer: @randx# App Version: 4.0upstream gitlab {  server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket;}server {  listen 443;  ssl                  on;  ssl_certificate      /etc/nginx/sites-available/server.crt;  ssl_certificate_key  /etc/nginx/sites-available/server.key;  server_name localhost;  #ubuntu1204-dell source.cml.com;     # e.g., server_name source.example.com;  root /home/gitlab/gitlab/public;  # individual nginx logs for this gitlab vhost  access_log  /var/log/nginx/gitlab_access.log;  error_log   /var/log/nginx/gitlab_error.log;  location / {    # serve static files from defined root folder;.    # @gitlab is a named location for the upstream fallback, see below    try_files $uri $uri/index.html $uri.html @gitlab;  }  # if a file, which is not found in the root folder is requested,  # then the proxy pass the request to the upsteam (gitlab unicorn)  location @gitlab {    proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694    proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694    proxy_redirect     off;    proxy_set_header   X-Forwarded-Proto $scheme;    proxy_set_header   Host              $http_host;    proxy_set_header   X-Real-IP         $remote_addr;    proxy_pass http://gitlab;  }}

Note the following four lines in server.

Listen to port 443 and enable SSL. The server. CRT and server. Key Files are generated according to the nginx documentation.

Finally, proxy_pass http: // gitlab cannot be modified. Do not change it to HTTPS. Otherwise, it cannot work.

Now try the check out code using https:

Git clone https ://....

An error is reported, indicating that the certificate verification is incorrect:

Error: server certificate verification failed. cafile:/etc/SSL/certs/ca-certificates.crt crlfile: None

The simplest solution is to add an environment variable:

export GIT_SSL_NO_VERIFY=1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.