Last active
March 19, 2019 06:52
-
-
Save alkanna/1b07c90857ff76cbc1dac2f295c94918 to your computer and use it in GitHub Desktop.
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 gitlab-workhorse { | |
server unix:/var/opt/gitlab/gitlab-workhorse/socket; | |
} | |
server { | |
listen *:80; | |
server_name _; | |
return 301 https://192.168.99.100$request_uri; | |
} | |
server { | |
listen *:443 ssl http2; | |
server_name _; | |
server_tokens off; ## Don't show the nginx version number, a security best practice | |
## Increase this if you want to upload large attachments | |
## Or if you want to accept large git objects over http | |
client_max_body_size 0; | |
## Strong SSL Security | |
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/ | |
ssl_certificate /etc/gitlab/ssl/gitlab.crt; | |
ssl_certificate_key /etc/gitlab/ssl/gitlab.key; | |
# GitLab needs backwards compatible ciphers to retain compatibility with Java IDEs | |
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:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4'; | |
ssl_protocols TLSv1.1 TLSv1.2; | |
ssl_prefer_server_ciphers on; | |
ssl_session_cache builtin:1000 shared:SSL:10m; | |
ssl_session_timeout 5m; | |
## Real IP Module Config | |
## http://nginx.org/en/docs/http/ngx_http_realip_module.html | |
## HSTS Config | |
## https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/ | |
add_header Strict-Transport-Security "max-age=31536000"; | |
## Individual nginx logs for this GitLab vhost | |
access_log /var/log/gitlab/nginx/gitlab_access.log; | |
error_log /var/log/gitlab/nginx/gitlab_error.log; | |
gzip on; | |
gzip_static on; | |
gzip_comp_level 2; | |
gzip_http_version 1.1; | |
gzip_vary on; | |
gzip_disable "msie6"; | |
gzip_min_length 10240; | |
gzip_proxied no-cache no-store private expired auth; | |
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml application/rss+xml; | |
location / { | |
client_max_body_size 0; | |
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_http_version 1.1; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_pass http://gitlab-workhorse; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment