2014-06-05 09:03:50 -04:00
|
|
|
## GitLab
|
|
|
|
##
|
|
|
|
## Modified from nginx http version
|
|
|
|
## Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
|
2014-08-04 09:57:59 -04:00
|
|
|
## Modified from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
|
2014-06-05 09:03:50 -04:00
|
|
|
##
|
2014-08-04 09:57:59 -04:00
|
|
|
## Lines starting with two hashes (##) are comments with information.
|
2014-08-22 13:10:07 -04:00
|
|
|
## Lines starting with one hash (#) are configuration parameters that can be uncommented.
|
2014-06-05 09:03:50 -04:00
|
|
|
##
|
|
|
|
##################################
|
2015-06-11 09:11:37 -04:00
|
|
|
## CONTRIBUTING ##
|
|
|
|
##################################
|
|
|
|
##
|
|
|
|
## If you change this file in a Merge Request, please also create
|
|
|
|
## a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests
|
|
|
|
##
|
2014-08-04 09:57:59 -04:00
|
|
|
###################################
|
2014-11-09 02:33:27 -05:00
|
|
|
## configuration ##
|
2014-08-04 09:57:59 -04:00
|
|
|
###################################
|
|
|
|
##
|
2014-09-07 18:31:13 -04:00
|
|
|
## See installation.md#using-https for additional HTTPS configuration details.
|
2014-06-05 09:03:50 -04:00
|
|
|
|
2015-10-29 09:21:24 -04:00
|
|
|
upstream gitlab-workhorse {
|
|
|
|
server unix:/home/git/gitlab/tmp/sockets/gitlab-workhorse.socket fail_timeout=0;
|
2015-08-31 09:30:15 -04:00
|
|
|
}
|
2015-07-28 08:33:19 -04:00
|
|
|
|
2014-11-09 02:33:27 -05:00
|
|
|
## Redirects all HTTP traffic to the HTTPS host
|
2014-06-05 09:03:50 -04:00
|
|
|
server {
|
2015-10-12 10:42:14 -04:00
|
|
|
## Either remove "default_server" from the listen line below,
|
2014-12-03 05:43:27 -05:00
|
|
|
## or delete the /etc/nginx/sites-enabled/default file. This will cause gitlab
|
|
|
|
## to be served if you visit any address that your server responds to, eg.
|
|
|
|
## the ip address of the server (http://x.x.x.x/)
|
2014-11-03 09:25:31 -05:00
|
|
|
listen 0.0.0.0:80;
|
2014-11-25 18:31:50 -05:00
|
|
|
listen [::]:80 ipv6only=on default_server;
|
2014-08-04 09:57:59 -04:00
|
|
|
server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com
|
|
|
|
server_tokens off; ## Don't show the nginx version number, a security best practice
|
2015-12-05 20:10:29 -05:00
|
|
|
return 301 https://$http_host$request_uri;
|
2014-11-09 02:33:27 -05:00
|
|
|
access_log /var/log/nginx/gitlab_access.log;
|
|
|
|
error_log /var/log/nginx/gitlab_error.log;
|
2014-06-05 09:03:50 -04:00
|
|
|
}
|
|
|
|
|
2014-08-22 16:51:59 -04:00
|
|
|
## HTTPS host
|
2014-06-05 09:03:50 -04:00
|
|
|
server {
|
2014-11-03 09:25:31 -05:00
|
|
|
listen 0.0.0.0:443 ssl;
|
2014-11-25 18:31:50 -05:00
|
|
|
listen [::]:443 ipv6only=on ssl default_server;
|
2014-08-04 09:57:59 -04:00
|
|
|
server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com
|
2014-11-09 02:33:27 -05:00
|
|
|
server_tokens off; ## Don't show the nginx version number, a security best practice
|
2014-06-05 09:03:50 -04:00
|
|
|
|
|
|
|
## Strong SSL Security
|
2014-10-16 02:51:53 -04:00
|
|
|
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
|
2014-06-05 09:03:50 -04:00
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/nginx/ssl/gitlab.crt;
|
|
|
|
ssl_certificate_key /etc/nginx/ssl/gitlab.key;
|
|
|
|
|
2014-10-10 03:44:08 -04:00
|
|
|
# GitLab needs backwards compatible ciphers to retain compatibility with Java IDEs
|
2015-06-15 05:40:00 -04:00
|
|
|
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
|
2014-10-16 02:51:53 -04:00
|
|
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
|
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
ssl_session_cache shared:SSL:10m;
|
2014-11-09 02:33:27 -05:00
|
|
|
ssl_session_timeout 5m;
|
2014-06-05 09:03:50 -04:00
|
|
|
|
2014-11-09 02:33:27 -05:00
|
|
|
## See app/controllers/application_controller.rb for headers set
|
2014-06-05 09:03:50 -04:00
|
|
|
|
2014-09-08 02:17:37 -04:00
|
|
|
## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
|
|
|
|
## Replace with your ssl_trusted_certificate. For more info see:
|
|
|
|
## - https://medium.com/devops-programming/4445f4862461
|
|
|
|
## - https://www.ruby-forum.com/topic/4419319
|
|
|
|
## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
|
|
|
|
# ssl_stapling on;
|
|
|
|
# ssl_stapling_verify on;
|
|
|
|
# ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
|
|
|
|
# resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired
|
2014-10-16 02:51:53 -04:00
|
|
|
# resolver_timeout 5s;
|
2014-09-08 02:17:37 -04:00
|
|
|
|
|
|
|
## [Optional] Generate a stronger DHE parameter:
|
2014-10-16 17:34:03 -04:00
|
|
|
## sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
|
2014-09-08 02:17:37 -04:00
|
|
|
##
|
|
|
|
# ssl_dhparam /etc/ssl/certs/dhparam.pem;
|
|
|
|
|
2014-06-05 09:03:50 -04:00
|
|
|
## Individual nginx logs for this GitLab vhost
|
|
|
|
access_log /var/log/nginx/gitlab_access.log;
|
|
|
|
error_log /var/log/nginx/gitlab_error.log;
|
|
|
|
|
|
|
|
location / {
|
2015-11-27 07:56:26 -05:00
|
|
|
client_max_body_size 0;
|
2015-08-31 09:30:15 -04:00
|
|
|
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;
|
|
|
|
|
2015-12-11 10:42:40 -05:00
|
|
|
proxy_http_version 1.1;
|
2015-09-07 07:05:29 -04:00
|
|
|
|
2015-08-31 09:30:15 -04:00
|
|
|
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;
|
2015-10-29 09:21:24 -04:00
|
|
|
proxy_pass http://gitlab-workhorse;
|
2015-08-31 09:30:15 -04:00
|
|
|
}
|
2016-02-27 03:28:00 -05:00
|
|
|
|
|
|
|
error_page 404 /404.html;
|
|
|
|
error_page 422 /422.html;
|
|
|
|
error_page 500 /500.html;
|
|
|
|
error_page 502 /502.html;
|
2016-04-22 16:26:18 -04:00
|
|
|
error_page 503 /503.html;
|
|
|
|
location ~ ^/(404|422|500|502|503)\.html$ {
|
2016-02-27 03:28:00 -05:00
|
|
|
root /home/git/gitlab/public;
|
|
|
|
internal;
|
|
|
|
}
|
2014-06-05 09:03:50 -04:00
|
|
|
}
|