1+ # GITLAB
2+ # Maintainer: @yin8086
3+ # App Version: 4.1
4+
5+ # Modified from nginx http version
6+ # Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
7+
8+ # You need from run openssl to generate the ssl certificate.
9+ # $ sudo openssl req -new -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key
10+ # $ sudo chmod o-r gitlab.key
11+
12+ upstream gitlab {
13+ server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket;
14+ }
15+
16+ # This is a normal HTTP host which redirects all traffic to the HTTPS host.
17+ server {
18+ listen 80;
19+ server_name Domain_NAME;
20+ root /nowhere;
21+ rewrite ^ https://gitlab.stardrad.com$request_uri permanent;
22+ }
23+ server {
24+ listen 443;
25+ server_name Domain_NAME;
26+ root /home/gitlab/gitlab/public;
27+
28+ ssl on;
29+ ssl_certificate gitlab.crt;
30+ ssl_certificate_key gitlab.key;
31+ ssl_protocols SSLv3 TLSv1 TLSv2;
32+ ssl_ciphers AES:HIGH:!ADH:!MD5;
33+ ssl_prefer_server_ciphers on;
34+
35+ # individual nginx logs for this gitlab vhost
36+ access_log /var/log/nginx/gitlab_access.log;
37+ error_log /var/log/nginx/gitlab_error.log;
38+
39+ location / {
40+ # serve static files from defined root folder;.
41+ # @gitlab is a named location for the upstream fallback, see below
42+ try_files $uri $uri/index.html $uri.html @gitlab;
43+ }
44+
45+ # if a file, which is not found in the root folder is requested,
46+ # then the proxy pass the request to the upsteam (gitlab unicorn)
47+ location @gitlab {
48+ proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
49+ proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
50+ proxy_redirect off;
51+
52+ proxy_set_header X-Forwarded-Proto https;
53+ proxy_set_header X-Forwarded-Ssl on;
54+ proxy_set_header Host $http_host;
55+ proxy_set_header X-Real-IP $remote_addr;
56+
57+ proxy_pass http://gitlab;
58+ }
59+ }
0 commit comments