Tag: nginx

Whatever your reason for placing an NGINX proxy in front of your Gitlab installation, you need to ensure you’re using the right configuration to support all of Gitlab’s features. I recently discovered that although my installation was mostly working I couldn’t get pipeline/build logs properly. I discovered that my proxy configuration was to blame. After some searching around I finally found that my config wasn’t quite right. To get the most out of Gitlab and ensure a smooth experience use configuration shown below as a template for your own. In my setup I use LetsEncrypt for SSL so if you’re not you can remove any of the SSL specific parts. The important configuration information is contained the the location block.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

upstreamgitlab{

server<ip of your gitlab server>:<port>;

}

server{

listen443;

server_name<your gitlab server hostname;

ssl on;

ssl_certificate<path tocert>;

ssl_certificate_key<path tokey>;

ssl_protocols TLSv1 TLSv1.1TLSv1.2;

ssl_prefer_server_ciphers on;

server_tokens off;

gzip on;

gzip_vary on;

gzip_disable"msie6";

gzip_types application/json;

gzip_proxied any;

gzip_comp_level6;

gzip_buffers168k;

gzip_http_version1.1;

location/{

client_max_body_size0;

proxy_set_header Host$http_host;

proxy_set_headerX-Real-IP$remote_addr;

proxy_set_headerX-Forwarded-Ssl on;

proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;

proxy_set_headerX-Forwarded-Proto$scheme;

proxy_pass https://gitlab;

}

}

This configuration will properly pass all requests through to your Gitlab server as well as allow CI/CD pipeline logs to pass through properly.