GitLab does not find index page

I installed GitLab from sources and configured nginx to serve the gitlab interface at the url https://gitlab.mydomain.com.
It is all working but if I am logged in and visit the root page (just gitlab.mydomain.com), it shows up an 404 error.

As I found out while searching in the production.log file, nginx tries to serve an index.html page which is (obviously) not available.

Here is my current config for nginx, I also tried it with @gitlab instead of @gitlab-workhorse (a different socket), with no success…:

location ^~ /.well-known {
    root /var/www/vhosts/mydomain.com/gitlab.mydomain.com;
}
location / {
	client_max_body_size 0;
	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;

	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-workhorse;
}

error_page 404 /404.html;
error_page 422 /422.html;
error_page 500 /500.html;
error_page 502 /502.html;
error_page 503 /503.html;
location ~ ^/(404|422|500|502|503)\.html$ {
	root /home/git/gitlab/public;
	internal;
}

The .well-known location is only for letsencrypt, that should not be a problem I think. If it is helpful for solving my problem, I am using Plesk Onyx for webhosting and configuration, but I disabled all default things so that my config is working properly.

Best regards,

Sebastian

I am stupid…

Forgot to set a flag in my web panel… Can be closed :wink:

I got a similar issue, can you tell me, wich flag was it?

I have the following setup (Menu entry Apache & nginx settings):

Common Apache settings --> everything default, “Restrict the ability to follow symbolic links” unchecked
nginx settings --> only “Proxy mode” checked

Additional nginx directives:

location ^~ /.well-known {
    root /var/www/vhosts/example.org/gitlab.example.org;
}

location ~ / {
	# serve static files from defined root folder;.
	# @gitlab is a named location for the upstream fallback, see below
	# for manual installation
	root /home/git/gitlab/public;
	try_files $uri $uri/index.html $uri.html @gitlab;
}

# if a file, which is not found in the root folder is requested,
# then the proxy pass the request to the upsteam (gitlab unicorn)
location @gitlab {
	proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
	proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
	proxy_redirect     off;

	proxy_set_header   X-Forwarded-Proto $scheme;
	proxy_set_header   Host              $http_host;
	proxy_set_header   X-Real-IP         $remote_addr;

	proxy_pass http://gitlab-workhorse;

}

I have this in my /etc/nginx/conf.d/gitlab.conf:

upstream gitlab {
    # for manual installation
    server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
upstream gitlab-workhorse {
    # for manual installation
    server unix:/home/git/gitlab/tmp/sockets/gitlab-workhorse.socket;
}

Gitlab is working with those settings. If you have further questions or errors, feel free to ask me :slight_smile:

1 Like

Hello.

When I try it as you wrote. I got a error. “Too many redirections”.

Can take a look to this ticket? There you can find my configuration and more informations.

Maybe you can help me with that? Thank you very much.

Yes, if i use the proxy mode under plesk 17.5 Onxy it works. With Nginx Only i got 404 Error-Pages.