Modify Nginx Configuraiton

I am looking for resources to add custom nginx configurations that impact the main route. So Im trying to block referrer connections and I have it working in a nginx test instance but I just dont know how to properly add it to gitlab. Any guidance is appreciated.

Usually any changes for nginx config options would be in /etc/gitlab/gitlab.rb however I don’t think the options you mention would be supported for that.

In this case, you would be better using an external nginx rather than the built-in one. This can be done following the documentation here: NGINX settings | GitLab

Therefore the built-in nginx is disabled, and you configure the external nginx with the appropriate gitlab config as per the documentation linked, along with your custom entries that you need.

1 Like

All im trying todo is this

valid_referers none blocked *;
        if ($invalid_referer) {
            return 403;

Within the location / { block

Just trying to block certain referrer urls

Have you tried the nginx['custom_gitlab_server_config'] setting?