Skip to content

Instantly share code, notes, and snippets.

@carlosspohr
Last active August 31, 2023 00:35
Show Gist options
  • Save carlosspohr/5486422 to your computer and use it in GitHub Desktop.
Save carlosspohr/5486422 to your computer and use it in GitHub Desktop.
Functional Apache2 route for Gitlab 5.0

For your Ruby, you'll must install this gems:

sudo gem install passenger

sudo passenger-install-apache2-module

At this moment, you'll asked to install some Apache2's deps (three deps):

sudo apt-get install apache2-prefork-dev

sudo apt-get install libapr1-dev

sudo apt-get install libaprutil1-dev

Enable these apache modules.

sudo a2enmod proxy

sudo a2enmod proxy_balancer

sudo a2enmod proxy_http

sudo a2enmod rewrite

Obs

At my install, I was needed install at port 8081 to don't conflict with my Apache Tomcat at port 8080, to change default Gitlab port I'm just edit /home/git/gitlab/config/gitlab.yml the port parameter.

The gist bellow gitlab.conf has been located at:

/etc/apache2/sites-available/gitlab.conf

And you can active this conf file with:

sudo a2ensite gitlab

You don't need create any symbolic link for public Apache2 folder.

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.19
PassengerRuby /usr/local/bin/ruby
<VirtualHost *:80>
ServerName localhost
# Point this to your public folder of teambox
DocumentRoot /home/git/gitlab/public
ProxyPass /gitlab/ http://localhost:8081/
ProxyPassReverse /gitlab/ http://localhost:8081/
<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>
@safar
Copy link

safar commented May 27, 2013

Will this work with Gitlab 5.2?

@brancz
Copy link

brancz commented May 28, 2013

I had to edit a config in puma.rb

bind 'tcp://127.0.0.1:9292'

is what I did and then my apache vhost looks like this

<VirtualHost *:80>
ServerName git.example.com

ProxyPass / http://127.0.0.1:9292/
ProxyPassReverse / http://127.0.0.1:9292/
ProxyPreserveHost On

CustomLog /var/log/apache2/gitlab/access.log combined
ErrorLog  /var/log/apache2/gitlab/error.log

Which works well for me, but I needed all of the dependencies.

Copy link

ghost commented Jun 4, 2013

@carlosjrcabello What operating system you are using? I can't do work my gitlab with this configuration. Do you do something in unicorn.rb? Thanks in advance!

@TracKer
Copy link

TracKer commented Jan 16, 2014

Please note, that first three lines of gitlab.conf file may differ on your system. This three lines must be provided in the final steps of sudo passenger-install-apache2-module execution. So just copy it from there.

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