I'm using gitlab-ce on docker. These are my system specifications.
- A container of GitLab is gitlab/gitlab-ce.
- The web frontend is using external NGINX.
- GitLab is mounted under /git.
I read the the gitlab documentation for configuring of a relative url, but it does not work as expected.
My expected behavior is that I access http:localhost/git/ as a root of GitLab.
But NGINX or GiLab redirects /user/_login instead of /git/user/_login.
All my configurations can be found in the following git project:
And this is my Dockerfile constructing GitLab. All configurations store an above url.
FROM gitlab/gitlab-ce
WORKDIR /var/opt/gitlab/
RUN mkdir -p ./gitlab-rails/etc/ && chown git:git ./gitlab-rails/etc/
RUN mkdir -p ./gitlab-shell && chown git:git ./gitlab-shell
ADD --chown=root:root gitlab.rb /etc/gitlab/gitlab.rb
ADD --chown=root:root relative_url.rb /var/opt/gitlab/gitlab-rails/etc/relative_url.rb
ADD --chown=root:root puma.rb /var/opt/gitlab/gitlab-rails/etc/puma.yml
ADD --chown=root:git gitlab.yml /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
ADD --chown=root:git config.yml /var/opt/gitlab/gitlab-shell/config.yml
WORKDIR /Please advise configuration changes.
1 Answer
I solved problems reference with the following document:
I need to set external_url and disable internal NGINX in the /etc/gitlab/gitlab.rb.
# See:
external_url ""
# NGINX config
nginx['enable'] = false
web_server['external_users'] = ['nginx']
web_server['username'] = 'nginx'
# web_server['group'] = 101
# rails config
gitlab_rails['trusted_proxies'] = ['172.17.0.0/16']
# HTTPS config
nginx['redirect_http_to_https'] = false
registry_nginx['redirect_http_to_https'] = false
mattermost_nginx['redirect_http_to_https'] = false
letsencrypt['enable'] = falseAnd configuration of external NGINX is following.
upstream gitlab { # Unix socket for Gitlabs server unix:/var/opt/gitlab/gitlab-workhorse/sockets/socket;
}
server { listen 0.0.0.0:80 default_server; listen [::]:80; server_tokens off; # Disable the nginx server version location ^~ /git/ { client_max_body_size 0; gzip off; # # Some requests take more than 30 seconds. proxy_read_timeout 300; proxy_connect_timeout 300; proxy_redirect 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-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # rewrite ^/git/(.*)$ /$1 break; # proxy_pass proxy_pass } location / { root /opt/app; index index.html index.html; }
}I mistake to understand between source installation and Omnibus GitLab.
There configurations are separate documented, but I'm not known it.
All configuration is written in /etc/gitlab/gitlab.rb on the Omnibus GitLab in the docker container.