Skip to content

Commit f4af3f2

Browse files
committed
Add nginx https support nginx/gitlab-https
1 parent 7e6a14f commit f4af3f2

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

nginx/gitlab-https

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

0 commit comments

Comments
 (0)