Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.14 KB | None | 0 0
  1. map $http_upgrade $connection_upgrade {
  2.     default upgrade;
  3.     ''      close;
  4. }
  5.  
  6. server {
  7.     listen 80;
  8.     listen [::]:80;
  9.     server_name instance.example.com;
  10.     location / { return 301 https://$host$request_uri; }
  11. }
  12.  
  13. server {
  14.     listen      443 ssl;
  15.     listen [::]:443 ssl;
  16.     server_name instance.example.com;
  17.  
  18.     # TLS
  19.     ssl_protocols TLSv1.2;
  20.     ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
  21.     ssl_prefer_server_ciphers on;
  22.     ssl_session_cache shared:SSL:10m;
  23.     ssl_certificate     /etc/letsencrypt/live/instance.example.com/fullchain.pem;
  24.     ssl_certificate_key /etc/letsencrypt/live/instance.example.com/privkey.pem;
  25.  
  26.     # Ciphers with intermediate compatibility
  27.     # https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=nginx-1.6.2&openssl=1.0.1t&hsts=yes&profile=intermediate
  28.     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  29.     #ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
  30.     # Follows the Web Security Directives from the Mozilla Dev Lab and the Mozilla Obervatory + Partners
  31.     # https://wiki.mozilla.org/Security/Guidelines/Web_Security
  32.     # https://observatory.mozilla.org/
  33.     add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
  34.     add_header Content-Security-Policy "upgrade-insecure-requests";
  35.     add_header Content-Security-Policy-Report-Only "default-src https: data: 'unsafe-inline' 'unsafe-eval'";
  36.     add_header X-Content-Type-Options nosniff;
  37.     add_header X-XSS-Protection "1; mode=block";
  38.     add_header X-Download-Options noopen;
  39.     add_header X-Permitted-Cross-Domain-Policies none;
  40.     add_header X-Frame-Options "SAMEORIGIN";
  41.  
  42.     gzip on;
  43.     gzip_disable "msie6";
  44.     gzip_vary on;
  45.     gzip_proxied any;
  46.     gzip_comp_level 6;
  47.     gzip_buffers 16 8k;
  48.     gzip_http_version 1.1;
  49.     gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;    
  50.  
  51.     # HSTS
  52.     add_header Strict-Transport-Security "max-age=31536000";
  53.  
  54.     location / {
  55.         proxy_set_header Host $host;
  56.         proxy_set_header X-Real-IP $remote_addr;
  57.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  58.         proxy_set_header X-Forwarded-Proto https;
  59.         proxy_pass_header Server;
  60.  
  61.         proxy_pass  http://private_ip:80;
  62.  
  63.     proxy_buffering off;
  64.         proxy_redirect off;
  65.         proxy_http_version 1.1;
  66.         proxy_set_header Upgrade $http_upgrade;
  67.         proxy_set_header Connection "upgrade";
  68.         tcp_nodelay on;
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement