Documentation - using non-bundled Nginx needs bundled gitlab-git-http-server vhost config
If you are using a non-bundled Nginx, the bundled gitlab-git-http-server does not work and returns an empty repository when cloning.
The example vhost config does not have any configuration for gitlab-git-http-server https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#vhost-server-block
I had to add this in addition to the example vhost config (I got it from the gitlab-ce config and changed the socket path) and now I can clone projects without any issue:
upstream gitlab-git-http-server {
server unix://var/opt/gitlab/gitlab-git-http-server/socket fail_timeout=0;
}
and inside the server directive
server {
location ~ [-\/\w\.]+\.git\/ {
## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
gzip off;
## https://github.com/gitlabhq/gitlabhq/issues/694
## Some requests take more than 30 seconds.
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
# Do not buffer Git HTTP responses
proxy_buffering off;
# The following settings only work with NGINX 1.7.11 or newer
#
# # Pass chunked request bodies to gitlab-git-http-server as-is
# proxy_request_buffering off;
# proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://gitlab-git-http-server;
}
}