Advertisement
coderboy

Untitled

Oct 2nd, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. upstream gitlab-workhorse {
  2. server unix:/var/opt/gitlab/gitlab-workhorse/socket fail_timeout=0;
  3. }
  4.  
  5. ## Redirects all HTTP traffic to the HTTPS host
  6. server {
  7. ## Either remove "default_server" from the listen line below,
  8. ## or delete the /etc/nginx/sites-enabled/default file. This will cause gitlab
  9. ## to be served if you visit any address that your server responds to, eg.
  10. ## the ip address of the server (http://x.x.x.x/)
  11. listen 0.0.0.0:80;
  12. listen [::]:80 ipv6only=on;
  13. server_name gitlab.meproduction.org; ## Replace this with something like gitlab.example.com
  14. server_tokens off; ## Don't show the nginx version number, a security best practice
  15. return 301 https://$http_host$request_uri;
  16. access_log /var/log/nginx/gitlab_access.log;
  17. error_log /var/log/nginx/gitlab_error.log;
  18. }
  19.  
  20. ## HTTPS host
  21. server {
  22. listen 0.0.0.0:443 ssl;
  23. listen [::]:443 ipv6only=on ssl;
  24. server_name gitlab.meproduction.org; ## Replace this with something like gitlab.example.com
  25. server_tokens off; ## Don't show the nginx version number, a security best practice
  26. root /opt/gitlab/embedded/service/gitlab-rails/public;
  27.  
  28. ## Strong SSL Security
  29. ## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
  30. ssl on;
  31. ssl_certificate /var/security/ssl/meproduction.org/server.crt;
  32. ssl_certificate_key /var/security/ssl/meproduction.org/server.key;
  33.  
  34. # GitLab needs backwards compatible ciphers to retain compatibility with Java IDEs
  35. 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";
  36. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  37. ssl_prefer_server_ciphers on;
  38. ssl_session_cache shared:SSL:10m;
  39. ssl_session_timeout 5m;
  40.  
  41. ## See app/controllers/application_controller.rb for headers set
  42.  
  43. ## [Optional] Enable HTTP Strict Transport Security
  44. ## HSTS is a feature improving protection against MITM attacks
  45. ## For more information see: https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/
  46. # add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
  47.  
  48. ## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
  49. ## Replace with your ssl_trusted_certificate. For more info see:
  50. ## - https://medium.com/devops-programming/4445f4862461
  51. ## - https://www.ruby-forum.com/topic/4419319
  52. ## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
  53. # ssl_stapling on;
  54. # ssl_stapling_verify on;
  55. # ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
  56. # resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired
  57. # resolver_timeout 5s;
  58.  
  59. ## [Optional] Generate a stronger DHE parameter:
  60. ## sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
  61. ##
  62. # ssl_dhparam /etc/ssl/certs/dhparam.pem;
  63.  
  64. ## Individual nginx logs for this GitLab vhost
  65. access_log /var/log/nginx/gitlab_access.log;
  66. error_log /var/log/nginx/gitlab_error.log;
  67.  
  68. location / {
  69. client_max_body_size 0;
  70. gzip off;
  71.  
  72. ## https://github.com/gitlabhq/gitlabhq/issues/694
  73. ## Some requests take more than 30 seconds.
  74. proxy_read_timeout 300;
  75. proxy_connect_timeout 300;
  76. proxy_redirect off;
  77.  
  78. proxy_http_version 1.1;
  79.  
  80. proxy_set_header Host $http_host;
  81. proxy_set_header X-Real-IP $remote_addr;
  82. proxy_set_header X-Forwarded-Ssl on;
  83. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  84. proxy_set_header X-Forwarded-Proto $scheme;
  85. proxy_pass http://gitlab-workhorse;
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement