Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 mywebsite.com:3000 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 mywebsite.com:3000. Please can you tell me where I am going wrong?

Apache:

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>
      BalancerMember http://127.0.0.1:3000
  </Proxy>

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

  RewriteEngine on
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  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
   </Proxy>
</VirtualHost>

Nginx:

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

server {
  listen 3000 default_server;         # e.g., listen 192.168.1.1:80;
  server_name 198.211.120.58;     # 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;
  }
}
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
add comment

1 Answer

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

Listen 198.211.120.58:3000. 

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

<VirtualHost 198.211.120.58:3000>

...

</VirtualHost>

Regards, Danie

share|improve this answer
add comment

Your Answer

 
discard

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.