Skip to content

Instantly share code, notes, and snippets.

@radmen
Created September 10, 2012 08:15
Show Gist options
  • Star 39 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save radmen/3689615 to your computer and use it in GitHub Desktop.
Save radmen/3689615 to your computer and use it in GitHub Desktop.
Apache vhost config for gitlab

unicorn config file

Edit file /home/gitlab/gitlab/config/unicorn.rb

Find line listen "#{app_dir}/tmp/sockets/gitlab.socket" and comment it. Uncomment line listen "127.0.0.1:8080"

required modules for apache

  • sudo a2enmod proxy
  • sudo a2enmod proxy_balancer
  • sudo a2enmod proxy_http
  • sudo a2enmod rewrite
<VirtualHost *:80>
ServerName git.domain.com
# Point this to your public folder of teambox
DocumentRoot /home/gitlab/gitlab
RewriteEngine On
<Proxy balancer://unicornservers>
BalancerMember http://127.0.0.1:8080
</Proxy>
# Redirect all non-static requests to thin
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]
ProxyPass / balancer://unicornservers/
ProxyPassReverse / balancer://unicornservers/
ProxyPreserveHost on
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
# Custom log file locations
ErrorLog /var/log/apache2/gitlab_error.log
CustomLog /var/log/apache2/gitlab_access.log combined
</VirtualHost>
@chaiwei
Copy link

chaiwei commented Jan 6, 2017

@omps Check your port 80 netstat -plnt | grep ':80' whether is overwrite by Nginx, It happens to my local server as well. My original webserver is running on apache2.4 after installed gitlab all website doesn't work anymore.

tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      16929/nginx
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      16884/config.ru
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      16929/nginx

https://kevingoedecke.me/2015/09/17/setup-gitlab-on-debian-7-with-existing-apache-webserver/
I follow the tutorial on this website to update it the gitlab.rb configuration file and now is back to

tcp6       0      0 :::8080                 :::*                    LISTEN      1233/apache2
tcp6       0      0 :::80                   :::*                    LISTEN      1233/apache2
tcp6       0      0 :::8081                 :::*                    LISTEN      1233/apache2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment