2

I am struggling to configure GitLab 8 with Apache 2.4 on RHEL 7.

So far, I have two options that are both unsatisfying: either I use the following Apache configuration file and have GitLab working smoothly, but every other apps unreachable:

<VirtualHost *:80>
  ServerName server_name

  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

  ProxyPass        / http://localhost:8080/
  ProxyPassReverse / http://localhost:8080/
  ProxyPassReverse / http://localhost:8081/

  <Location />
    Require all granted
  </Location>                                       

  # Custom log file locations
  ErrorLog  /var/log/httpd/gitlab_error.log
  CustomLog /var/log/httpd/gitlab_access.log combined
</VirtualHost>

Either I try the following, and everything else is working, I can access GitLab login page (through http://server_name/gitlab/users/sign_in) but it then fails as it tries to connect to http://server_name/[stuff], without /gitlab:

<VirtualHost *:80>
  ServerName server_name

  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

  ProxyPass        /gitlab http://localhost:8080/
  ProxyPassReverse /gitlab http://localhost:8080/
  ProxyPassReverse /gitlab http://localhost:8081/

  <Location /gitlab>
    Require all granted
  </Location>

  # Custom log file locations
  ErrorLog  /var/log/httpd/gitlab_error.log
  CustomLog /var/log/httpd/gitlab_access.log combined
</VirtualHost>

I am far from being an expert with Apache, so I'm probably missing something obvious, but I can't pin down what is wrong here.

Any help would be greatly appreciated!

Edit:

I changed my Apache configuration to redirect the thing on 8088 port:

<VirtualHost *:8088>
  ServerName localhost
  ServerAlias server-rd

  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

  ProxyPass        / http://localhost:8080
  ProxyPassReverse / http://localhost:8080
  ProxyPassReverse / http://localhost:8081

  <Location />
    Require all granted
  </Location>

  # Custom log file locations                                                                                                                                                               
  ErrorLog  /var/log/httpd/gitlab_error.log
  CustomLog /var/log/httpd/gitlab_access.log combined
</VirtualHost>

I also enabled 8088 port in SELinux.

Other apps work well, but I still can't access GitLab, I get an "Unable to connect" error with my browser.

I tried to connect with telnet, just to see:

telnet localhost 8088
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET /
<html><body>You are being <a href="http://localhost:8080/users/sign_in">redirected</a>.</body></html>Connection closed by foreign host.

So it's kind of working, the problem seems to be after this first step. I tried to get the webpage with wget:

wget http://localhost:8088
--2015-11-06 16:16:58--  http://localhost:8088/
Résolution de localhost (localhost)... ::1, 127.0.0.1
Connexion vers localhost (localhost)|::1|:8088...connecté.
requête HTTP transmise, en attente de la réponse...302 Found
Emplacement: http://localhost:8088/users/sign_in [suivant]
--2015-11-06 16:16:58--  http://localhost:8088/users/sign_in
Reusing existing connection to [localhost]:8088.
requête HTTP transmise, en attente de la réponse...502 Proxy Error
2015-11-06 16:16:58 ERREUR 502: Proxy Error.

Some things are in French, sorry, but at least the most important stuff appears clearly: ERREUR 502: Proxy Error.

I checked, mod_proxy is installed and enabled, so I don't know what to do next.

MBR
  • 141
  • 2
  • 9

1 Answers1

0

I would recommend you use a separate VHost for GitLab.

If you can not use a subdomain or another IP address, use a different port for gitlab.

I'm not saying that this can not be configured correctly as you want to, but it can cause a lot of problems with access via the web and through git clients.

  • I am a little bit lost with ports and Apache; what I simply tried to do was to change `` by something like `` but it does not work either. – MBR Nov 05 '15 at 15:27
  • In addition to what you've done, you should add to the file **/etc/httpd/conf/httpd.conf** something like that `Listen 8082` – Rafał Niewiński Nov 05 '15 at 15:46
  • Thanks for your help. I did that (and add this port to authorized ports in SELinux), but still, when I connect to `http://server_name:8082` it fails (unable to connect)... – MBR Nov 05 '15 at 17:20
  • I updated my question explaining a little bit more deeply the last problems I encountered. – MBR Nov 06 '15 at 15:36