# Apache 2 version The configuration files in this directory are known to work with GitLab 8.3 and newer versions. For versions of GitLab 8.2, check the `8-2-stable` branch. For versions of GitLab 8.0 and 8.1, check the `8-1-stable` branch. For versions of GitLab older than 8.0, check the `apache-old` branch. ## Installations from source If you are using Apache version 2.4 or above, please use files [gitlab-apache24.conf](gitlab-apache24.conf) or [gitlab-ssl-apache24.conf](gitlab-ssl-apache24.conf) for the HTTP and HTTPS versions of the vhost repectively. If you are using Apache version 2.2, please use files [gitlab-apache22.conf](gitlab-apache22.conf) or [gitlab-ssl-apache22.conf](gitlab-ssl-apache22.conf) for the HTTP and HTTPS versions of the vhost repectively. To allow `gitlab-workhorse` to listen on port 8181, edit or create `/etc/default/gitlab` and change or add the following: ``` gitlab_workhorse_options="-listenUmask 0 -listenNetwork tcp -listenAddr 127.0.0.1:8181 -authBackend http://127.0.0.1:8080" ``` ## Installations unsing the Omnibus packages [Omnibus packages][] use their own bundled Nginx server. If you want to use your own external Apache server, follow the steps to [configure GitLab][omnibuswebext]. In the last step you will need to download the config from this repository. # RHEL6/CentOS6 recommendations Most of the settings below were tested on CentOS 6, but are probably applicable to other distributions as well. ## Puma or unicorn? ### unicorn By default, Unicorn (i.e. `unicorn.rb`) is configured to listen on port `8080` in GitLab's documentation. Therefore, the Apache configuration files do that by default. ### puma Info taken from [PR #87](https://github.com/gitlabhq/gitlab-recipes/pull/87). As apache's mod_proxy [doesn't support][sock] sockets, the proxy URL must be configured to use tcp instead of unix sockets. `/home/git/gitlab/config/puma.rb` should exist and be configured. Two changes must then be made: 1. In the Apache conf replace `http://127.0.0.1:8080 ` with `http://0.0.0.0:9292`. Also replace `ProxyPassreverse http://gitlab.example.com:9292` 2. Edit `puma.rb`: comment out `bind 'tcp://0.0.0.0:9292'` and comment `bind "unix://#{application_path}/tmp/sockets/gitlab.socket"` ## Assumptions It is assumed GitLab will be running in a secure production environment. This Apache `httpd` configuration is hardened for that purpose. By default this configuration only allows strong SSL and HTTP is redirected to HTTPS. If self signed certificates are preferred then see below in this document on managing SSL certificates. Also see additional security recommendations located at the bottom of this document for `httpd`. Managing GitLab with plain text HTTP only is not recommended however the config files have been provided for that purpose. ### Encryption assumptions Only security ciphers TLSv1.0+ and SSLv3+ are used in Apache ssl configs. Only strong ciphers 128-bit or higher. Ciphers with known weaknesses (i.e. MD5 hashed and RC4 based ciphers) have been purposefully excluded. ### Run GitLab insecure with HTTP only Utilize the configs without ssl in their names to run GitLab without https. Running a production GitLab instance over plain text HTTP is NOT recommended. ## Customize gitlab-ssl-*.conf There are a few places where the Apache configs need to be customized for the GitLab installation. 1. `ServerName` is defined in two VirtualHosts. `ServerName` should be set to host name of the GitLab installation. 2. `SSLCertificateFile`, `SSLCertificateKeyFile`, and `SSLCACertificateFile` should be customized for signed certificates. 3. `ProxyPassReverse http://gitlab.example.com:8080` should be customized for public host name of the GitLab installation. 4. At the bottom of `gitlab-ssl.conf` log file names contain `gitlab.example.com`. The log file names should reflect the GitLab installation host name. A quicker method is to use `sed` to modify the file. ```bash sed -i 's/gitlab.example.com/yourhost.com/g' gitlab-ssl-*.conf ``` Even with the quicker method `SSLCertificateFile`, `SSLCertificateKeyFile`, and `SSLCACertificateFile` should still be modified. ## SELinux modifications In a RHEL6 production environment it is assumed [SELinux is enabled](http://stopdisablingselinux.com/). SELinux must be configured with the following: ```bash setsebool -P httpd_can_network_connect on setsebool -P httpd_can_network_relay on setsebool -P httpd_read_user_content on semanage -i - <