I
I
Iceforest2021-10-14 18:28:52
Nginx
Iceforest, 2021-10-14 18:28:52

How to migrate gitlab from haproxy to Nginx?

we want to transfer gitlab from haproxy to Nginx, for some reason the config does not work
Nginx config

server
{
        listen 80;
        server_name gitlab.*.ru;

location /
        {
                return 301 https://gitlab.*.ru;
        }
}
server
{
        listen 443 ssl;
        server_name gitlab.*.ru;


        location /
                {
                        proxy_pass http://10.*.*.50;
                        proxy_set_header X-Forwarded-Proto https;
                        proxy_set_header X-Forwarded-Ssl  on;

                }

}


Through haproxy it works like this
global
    log         127.0.0.1 local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon
    tune.ssl.default-dh-param 2048
    
    stats socket /var/lib/haproxy/stats

defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000


frontend www-http
bind *:80
reqadd X-Forwarded-Proto:\ http

frontend gitlab_front
bind 80.*.*.*:443
mode tcp
use_backend gitlab


backend gitlab
mode tcp
option ssl-hello-chk
server gitlab_server 10.*.*.*:443


in gitlab.rb
nginx['enable'] = true
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/git-le.crt"
nginx['ssl_certificate_key'] = "/ etc/gitlab/ssl/git-le-key.key"
nginx['proxy_set_headers'] = {"X-Forwarded-Proto" => "https",
"X-Forwarded-Ssl" => "on",}

Actually the question is why does not work through the Nginx config?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2021-10-14
@Iceforest

Where are the SSL settings in the lower config block? Plus, if you have encryption on an external nginx, adding it inside is pretty pointless.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question