Setting up Gitlab on Ubuntu 14.04 with Apache2 without owning a domain name

I’ll open up that new topic. Thanks!

@axil,

Thanks a lot! I didn’t fully understand DNS (still don’t) but that is where my problem was. Now everything is working.

I am trying to install gitlab-ce on Ubuntu 16.04.
I’ve followed the steps given above - changes to /etc/gitlab/gitlab.rb and apache2/sites-enabled/000-default files are done.

I’m running the server on port 8000.

So I’ve the following configuration in 000-default file of apache: ({domainname} is the name of my domain)

<VirtualHost *:8000>
ServerName foss.{domainname}
ServerSignature Off

ProxyPreserveHost On

Ensure that encoded slashes are not decoded but left in their encoded state.

http://doc.gitlab.com/ce/api/projects.html#get-single-project

AllowEncodedSlashes NoDecode

<Location />
# New authorization commands for apache 2.4 and up
# http://httpd.apache.org/docs/2.4/upgrading.html#access
Require all granted

#Allow forwarding to gitlab-workhorse
ProxyPassReverse http://127.0.0.1:8080/
ProxyPassReverse http://foss.{domainname}:8000/

</Location>

Apache equivalent of nginx try files

http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files

http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab

RewriteEngine on

DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public/
#Forward all requests to gitlab-workhorse except existing files like error documents
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^/uploads/.*
RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA,NE]

needed for downloading attachments

#Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
ErrorDocument 404 /404.html
ErrorDocument 422 /422.html
ErrorDocument 500 /500.html
ErrorDocument 502 /502.html
ErrorDocument 503 /503.html

It is assumed that the log directory is in /var/log/httpd.

For Debian distributions you might want to change this to

/var/log/apache2.

LogFormat “%{X-Forwarded-For}i %l %u %t “%r” %>s %b” common_forwarded
ErrorLog /var/log/apache2/gitlab_foss_error.log
CustomLog /var/log/apache2/gitlab_foss_forwarded.log common_forwarded
CustomLog /var/log/apache2/gitlab_foss_access.log combined env=!dontlog
CustomLog /var/log/apache2/gitlab_foss.log combined

</VirtualHost>

I’ve the following configuration in /etc/gitlab/gitlab.rb
external_url "http://foss.{domainname}:8000/" web_server['external_users'] = ['www-data'] nginx['enable'] = false

I’ve done “gitlab-ctl reconfigure” and “service apache2 restart” as well.

On Acccessing the website as
http://foss.{domainname}:8000/

I’m getting this error
"Not Found: /"

Contents of log file gitlab_foss_access.log

117.195.35.162 - - [26/Oct/2016:23:40:25 +0530] "GET / HTTP/1.1" 404 244 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0"

There is no entry in gitlab_foss_error.log file.

Please help.

I’ve get to the same point, but have a different error:
[Mon Sep 18 17:17:14.808166 2017] [proxy:error] [pid 13797] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:8181 (*) failed
[Mon Sep 18 17:17:14.808239 2017] [proxy_http:error] [pid 13797] [client 192.168.0.245:58178] AH01114: HTTP: failed to make connection to backend: 127.0.0.1

Can someone help on this ?

I’m getting exactly the same error. I’m trying to run Gitlab on Opensuse with apache so I can use shibboleth as authentication service. Currently it’s just a test setup, no domain name, no ssl.

As virtual host config I have used this file: https://gitlab.com/gitlab-org/gitlab-recipes/blob/master/web-server/apache/gitlab-omnibus-apache24.conf and just set the ip of my server where necessary.
I have also configured the external_url in the gitlab.rb file and did all configurations from the manual (https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server).

It would be great if someone could point out what’s wrong or what needs to be done.

May be useful for someone referencing this post.

Looks like this error is because of missing below configuration.

Apache cannot connect to a UNIX socket but instead needs to connect to a TCP Port. To allow gitlab-workhorse to listen on TCP (by default port 8181) edit /etc/gitlab/gitlab.rb:

gitlab_workhorse[‘listen_network’] = “tcp”
gitlab_workhorse[‘listen_addr’] = “127.0.0.1:8181”

Run sudo gitlab-ctl reconfigure for the change to take effect.

gitlab-workhorse is listening on port 8181. 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

1 Like

I am attempting do perform a similar install to above, have followed the directions above and here:
https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server

Using the recipe here:
https://gitlab.com/gitlab-org/gitlab-recipes/blob/master/web-server/apache/gitlab-apache24.conf

and setting DocumentRoot to:
DocumentRoot opt/gitlab/embedded/service/gitlab-rails/public$

I am trying to have Gitlab exist in a relative path /gitlab

I have simply no luck making anything work, I simply get “document not found”

I have external_url configured as below:

external_url ‘http:// ipaddress /gitlab’

Thoughts?