Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #2071

Closed
Open
Created Nov 26, 2012 by Administrator@rootOwner

[Solved] How to get this working 100% with apache2

Created by: LordPsyan

OK, so I spent 3 days reinstalling the OS, doing backups, and trying to get this to work...

Run a normal website using www.mydomain.com and gitlabhq using git.mydomain.com

I read a dozen or more different posts on how to do this. and I finally mastered it. turns out there are only a few extra steps to get this done (should put this in the installation.md file)

Assuming it is a fresh OS install, and no web server present. Works on Debian wheezy, most likely on squeeze, and probably on Ubuntu

Do everything exactly as the instructions.md file states... until you get to nginx. At this point, you need to install apache2. There are many tuts on installing this properly... but I have learned the fasted, easiest and most accurate way to install apache2 with pretty much everything you need is:

apt-get install apache2-prefork-dev libapr1-dev libaprutil1-dev phpmyadmin

The phpmyadmin program can come in handy later for other php related projects, so instead of adding apache2-common php5 blah blah, I just fo phpmyadmin. apt-get will automatically grab the other stuff. Now, this is just a recommendation, but you should edit your /etc/apt/sources.list file as instructed on http://www.dotdeb.org/instructions/

once this is done, you need to install passenger sudo gem install passenger && sudo passenger-install-apache2-module

when that finishes, you need to create a passenger.load file. This goes in /etc/apache2/mods-available/

Inside that file put this:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.13/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.13 PassengerRuby /usr/local/bin/ruby

save it. Now we need to enable the mods needed by apache:

sudo a2enmod passenger proxy proxy_balancer proxy_http  rewrite

you CAN restart apache2 now if you want, but might as wait until you make the virtual host file.

Create a file. Name it something like git.mydomain.com Place the following inside (modify git.mydomain.com to the url you want.)

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

DocumentRoot /home/gitlab/gitlab/public

RewriteEngine On

<Proxy balancer://unicornservers> BalancerMember http://127.0.0.1:8080

Redirect all non-static requests to thin

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]

ProxyPass / http://localhost:3000/ ProxyPassReverse / http://localhost:3000/ ProxyPreserveHost On

<Proxy *> Order deny,allow Allow from all

Custom log file locations

ErrorLog /var/log/apache2/gitlab_error.log CustomLog /var/log/apache2/gitlab_access.log combined

save the file. then just run: service apache2 restart or /etc/init.d/apache2 restart (some machines don't have the "service" command)

It should be all finished. I added 1 small step, because for some reason (even doing the nginx way) I could not get anything but "down for maintenance" error, unless I ran:

sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production

I have to do that after every restart. No friggin idea why. I actually added that line in the gitlab script, so it does it at startup. takes a little longer to boot, but hey, its Linux, you only have to reboot once every 5 or 6 years... unlike Windows, which needs a good restart every week or so. :)

Oh, it is not mentioned anywhere, but please change [email protected] password....

Assignee
Assign to
Time tracking