Skip to content

Instantly share code, notes, and snippets.

@prolic
Last active August 9, 2016 13:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prolic/6776700 to your computer and use it in GitHub Desktop.
Save prolic/6776700 to your computer and use it in GitHub Desktop.
gitlab nginx config
upstream jenkins {
server 127.0.0.1:8081 fail_timeout=0;
}
upstream gitlab {
## Uncomment if you have set up puma/unicorn to listen on a unix socket (recommended).
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
## Uncomment if puma/unicorn are configured to listen on a tcp port.
## Check the port number in /home/git/gitlab/config/{puma.rb/unicorn.rb}
# server 127.0.0.1:9292;
}
server {
listen 80;
server_name dev.*****;
server_tokens off;
rewrite ^ https://$server_name$request_uri permanent;
}
server {
listen 80;
server_name ci.*****;
server_tokens off;
rewrite ^ https://$server_name$request_uri permanent;
}
server {
listen 443 ssl;
server_name ci.*****;
# All your server and TLS/certificate settings are up here somewhere
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1 TLSv1.2;
ssl_ciphers AES:HIGH:!ADH:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
# proxy_redirect off;
proxy_redirect http:// https://;
add_header Pragma "no-cache";
proxy_pass http://jenkins;
}
}
server {
listen 443 ssl;
server_name dev.*****;
# All your server and TLS/certificate settings are up here somewhere
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1 TLSv1.2;
ssl_ciphers AES:HIGH:!ADH:!MD5;
ssl_prefer_server_ciphers on;
# auth_basic "Restricted";
# auth_basic_user_file /home/jenkins/htpasswd;
location / {
try_files $uri $uri/index.html $uri.html @gitlab;
}
location ~ ^/(assets|uploads)/ {
root /home/git/gitlab/public;
expires max;
add_header Cache-Control public;
add_header ETag "";
break;
}
location @gitlab {
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_redirect off;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://gitlab;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment