Search code examples
apachegithubgitlabcentos7gitlab-omnibus

How to install gitlab separate on centos7?


I wish to install gitlab on my Centos 7 server. But I need to separate the gitlab and apache folder. That is when I type localhost should get the index page in HTML folder and when I type git.example.com should get the gitlab page. Is there any way to do this? Please help me, anyone.


Solution

  • Might not be the best solution, but what I did was to set a "front NGINX" to proxy my 3 services: Apache (at www), Redmine (at issues) and GitLab (at git)

    Then I configured my Apache to listen on another port (say 808). And my GitLab to listen on its own port (say 809).

    And I added a server configuration in NGINX with a proxypass using something like this:

    server {
      listen 80;
      server_name www.example.com;
      location / {
        access_log off;
        proxy_pass http://localhost:808;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
    }
    

    and one for the GitLab as:

    server {
      listen 80;
      server_name git.example.com;
      location / {
        access_log off;
        proxy_pass http://localhost:809;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
      error_page 502 /502.html;
      location = /502.html {
        root  /opt/gitlab/error_pages;
      }
    }