Skip to content

Instantly share code, notes, and snippets.

@sameersbn
Created July 23, 2014 17:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sameersbn/82cc2a1e84705ebba86e to your computer and use it in GitHub Desktop.
Save sameersbn/82cc2a1e84705ebba86e to your computer and use it in GitHub Desktop.
gitlab-ci nginx load balance config
upstream gitlab_ci {
server 172.17.42.1:50088;
}
## This is a normal HTTP host which redirects all traffic to the HTTPS host.
server {
listen 80;
server_name ci.example.com;
server_tokens off;
root /dev/null;
rewrite ^ https://$server_name$request_uri permanent;
}
server {
listen 443 ssl spdy;
server_name ci.example.com;
server_tokens off;
root /dev/null;
ssl on;
add_header Strict-Transport-Security max-age=63072000;
# add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
## Individual nginx logs for this vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
## proxy pass the request to upsteam.
location / {
## If you use https make sure you disable gzip compression
## to be safe against BREACH attack.
gzip off;
## https://github.com/gitlabhq/gitlabhq/issues/694
## Some requests take more than 30 seconds.
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://gitlab_ci;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment