Merge pull request #8273 from bbodenmiller/nginx-updates

Nginx updates
This commit is contained in:
Marin Jankovski 2014-11-10 10:20:44 +01:00
commit 70f30abd84
2 changed files with 15 additions and 16 deletions

View file

@ -1,5 +1,5 @@
## GitLab ## GitLab
## Maintainer: @randx ## Contributors: randx, yin8086, sashkab, orkoden, axilleas, bbodenmiller
## ##
## Lines starting with two hashes (##) are comments with information. ## Lines starting with two hashes (##) are comments with information.
## Lines starting with one hash (#) are configuration parameters that can be uncommented. ## Lines starting with one hash (#) are configuration parameters that can be uncommented.
@ -15,7 +15,7 @@
## - installing an old version of Nginx with the chunkin module [2] compiled in, or ## - installing an old version of Nginx with the chunkin module [2] compiled in, or
## - using a newer version of Nginx. ## - using a newer version of Nginx.
## ##
## At the time of writing we do not know if either of these theoretical solutions works. ## At the time of writing we do not know if either of these theoretical solutions works.
## As a workaround users can use Git over SSH to push large files. ## As a workaround users can use Git over SSH to push large files.
## ##
## [0] https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99 ## [0] https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99
@ -26,6 +26,7 @@
## configuration ## ## configuration ##
################################### ###################################
## ##
## See installation.md#using-https for additional HTTPS configuration details.
upstream gitlab { upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket fail_timeout=0; server unix:/home/git/gitlab/tmp/sockets/gitlab.socket fail_timeout=0;
@ -43,6 +44,8 @@ server {
## Or if you want to accept large git objects over http ## Or if you want to accept large git objects over http
client_max_body_size 20m; client_max_body_size 20m;
## See app/controllers/application_controller.rb for headers set
## Individual nginx logs for this GitLab vhost ## Individual nginx logs for this GitLab vhost
access_log /var/log/nginx/gitlab_access.log; access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log; error_log /var/log/nginx/gitlab_error.log;

View file

@ -1,5 +1,5 @@
## GitLab ## GitLab
## Contributors: randx, yin8086, sashkab, orkoden, axilleas ## Contributors: randx, yin8086, sashkab, orkoden, axilleas, bbodenmiller
## ##
## Modified from nginx http version ## Modified from nginx http version
## Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/ ## Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
@ -26,9 +26,8 @@
## [1] https://github.com/agentzh/chunkin-nginx-module#status ## [1] https://github.com/agentzh/chunkin-nginx-module#status
## [2] https://github.com/agentzh/chunkin-nginx-module ## [2] https://github.com/agentzh/chunkin-nginx-module
## ##
##
################################### ###################################
## SSL configuration ## ## configuration ##
################################### ###################################
## ##
## See installation.md#using-https for additional HTTPS configuration details. ## See installation.md#using-https for additional HTTPS configuration details.
@ -37,24 +36,24 @@ upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket fail_timeout=0; server unix:/home/git/gitlab/tmp/sockets/gitlab.socket fail_timeout=0;
} }
## Normal HTTP host ## Redirects all HTTP traffic to the HTTPS host
server { server {
listen 0.0.0.0:80; listen 0.0.0.0:80;
listen [::]:80 default_server; listen [::]:80 default_server;
server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com 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 server_tokens off; ## Don't show the nginx version number, a security best practice
return 301 https://$server_name$request_uri;
## Redirects all traffic to the HTTPS host access_log /var/log/nginx/gitlab_access.log;
root /nowhere; ## root doesn't have to be a valid path since we are redirecting error_log /var/log/nginx/gitlab_error.log;
rewrite ^ https://$server_name$request_uri? permanent;
} }
## HTTPS host ## HTTPS host
server { server {
listen 0.0.0.0:443 ssl; listen 0.0.0.0:443 ssl;
listen [::]:443 ssl default_server; listen [::]:443 ssl default_server;
server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com
server_tokens off; server_tokens off; ## Don't show the nginx version number, a security best practice
root /home/git/gitlab/public; root /home/git/gitlab/public;
## Increase this if you want to upload large attachments ## Increase this if you want to upload large attachments
@ -72,12 +71,9 @@ server {
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on; ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m; ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
## [WARNING] The following header states that the browser should only communicate ## See app/controllers/application_controller.rb for headers set
## with your server over a secure connection for the next 24 months.
add_header Strict-Transport-Security max-age=63072000;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL. ## [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: ## Replace with your ssl_trusted_certificate. For more info see: