Last active
August 9, 2016 13:44
-
-
Save prolic/6776700 to your computer and use it in GitHub Desktop.
gitlab nginx config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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