Gitlab 5.3 behind nginx reverse proxy

2019-05-28 02:31发布

I have a successful Gitlab 5.3 install and everything works well. I want to run the server behind a nginx reverse proxy which I manage to do, but all the assets are missing:

Gitlab front page

I have Gitlab running on /git and here is my nginx config on my reverse proxy server:

server {
    listen      80 default;
    listen      [::]:80 ipv6only=on default;

    server_name     reverseproxy;
    ## redirect http to https
    rewrite     ^ https://$server_name$request_uri? permanent;

}

server {
    access_log  /var/log/nginx/ssl_access.log;
    error_log   /var/log/nginx/ssl_error.log;
    index index.html index.htm index.php;

    ## start ssl config
    listen 443; 
    server_name reverseproxy;


    ## ssl server specifics 
    ssl on;
    ssl_certificate     /root/reverseproxy/reverseproxy.crt;
    ssl_certificate_key     /root/reverseproxy/reverseproxy.key;

    ssl_session_cache   shared:SSK:10m;
    ssl_session_timeout     10m;

    ssl_protocols SSLv3 TLSv1;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
    ssl_prefer_server_ciphers on;

    location /git {
        proxy_pass      http://gitlabserver/git;

        proxy_redirect off;
        proxy_set_header Host           $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;
    }       
}

I have looked through nginx access and error logs but no clue. Any hints greatly appreciated.

1条回答
ゆ 、 Hurt°
2楼-- · 2019-05-28 02:58

Assuming that the git daemon and the nginx daemon are on the same box I believe that the location block should be like the following:

location ^~ /git/ {
    proxy_pass                          http://127.0.0.1/git;
    proxy_redirect                      http://127.0.0.1/git/  /git;
    proxy_set_header Host               $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;
}
查看更多
登录 后发表回答