Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed Gitlab on my server which was using Nginx at the time, but we have since switched to Apache2, and I cannot seem to get to refer to /home/gitlab/gitlab/public as it did, working perfectly, in Nginx. At the moment, the page never actually loads when a request is made to Please can you tell me where I am going wrong?


Listen 3000
<VirtualHost *:3000>
  DocumentRoot /home/gitlab/gitlab/public
  ErrorLog /var/log/apache2/gitlab_error_log
  CustomLog /var/log/apache2/gitlab_access_log combined

  <Proxy balancer://unicornservers>

  <Directory /home/gitlab/gitlab/public>
    AllowOverride All
    Options -MultiViews

  RewriteEngine on
  RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]

  ProxyPass /uploads !
  ProxyPass / balancer://unicornservers/
  ProxyPassReverse / balancer://unicornservers/
  ProxyPreserveHost on

   <Proxy *>
      Order deny,allow
      Allow from all


upstream gitlab {
  server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket;

server {
  listen 3000 default_server;         # e.g., listen;
  server_name;     # e.g., server_name;
  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; #
    proxy_connect_timeout 300; #
    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;
share|improve this question
Can you elaborate on what is specifically happening when the page fails to load? Any HTTP error codes? Log messages? – Andrew B Mar 15 '13 at 2:45

First thing

When using apache's Listen directive with just a port, forces apache to listen on all available IPs/Interfaces, it's a wildcard entry and this will undoubtedly be interfering with your load balancer listening on localhost:3000, this would've caused apache not to start up as it could bind to that port, if I'm not mistaken. But try the following and let me know.

You will need to specify the ip you want apache to listen to. In you case, it should be


Lastly you will need to specify your apache virtualhost, e.g.




Regards, Danie

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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