Advertisement
Guest User

Roundcube nginx config

a guest
Dec 21st, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.00 KB | None | 0 0
  1. server {
  2.         listen 80;
  3.         server_name example.com;
  4.         return 301 https://example.com$request_uri;
  5.  
  6.         root /path/to/example.com/docroot;
  7.         index index.php;
  8.  
  9.         access_log /var/log/nginx/example.com-access.log;
  10.         error_log /var/log/nginx/example.com-error.log;
  11.  
  12.         location / {
  13.                 try_files $uri $uri/ /index.php?q=$uri&$args;
  14.         }
  15.  
  16.         location ~ /.well-known {
  17.                 auth_basic off;
  18.                 allow all;
  19.         }
  20.  
  21.         location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
  22.                 deny all;
  23.         }
  24.  
  25.         location ~ ^/(config|temp|logs)/ {
  26.                 deny all;
  27.         }
  28.  
  29.         location ~ /\. {
  30.                 deny all;
  31.                 access_log off;
  32.                 log_not_found off;
  33.         }
  34.  
  35.         location ~ \.php$ {
  36.                 include snippets/fastcgi-php.conf;
  37.                 fastcgi_pass unix:/var/run/php5-fpm.sock;
  38.                 fastcgi_intercept_errors on;
  39.                 fastcgi_buffer_size 128k;
  40.                 fastcgi_buffers 256 4k;
  41.                 fastcgi_busy_buffers_size 256k;
  42.                 fastcgi_temp_file_write_size 256k;
  43.         }
  44. }
  45.  
  46. server {
  47.         listen 443 ssl http2;
  48.         server_name example.com;
  49.  
  50.         root /path/to/example.com/docroot;
  51.         index index.php;
  52.  
  53.         access_log /var/log/nginx/example.com-access.log;
  54.         error_log /var/log/nginx/example.com-error.log;
  55.  
  56.         location / {
  57.                 try_files $uri $uri/ /index.php?q=$uri&$args;
  58.         }
  59.  
  60.         location ~ /.well-known {
  61.                 auth_basic off;
  62.                 allow all;
  63.         }
  64.  
  65.         location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
  66.                 deny all;
  67.         }
  68.  
  69.         location ~ ^/(config|temp|logs)/ {
  70.                 deny all;
  71.         }
  72.  
  73.         location ~ /\. {
  74.                 deny all;
  75.                 access_log off;
  76.                 log_not_found off;
  77.         }
  78.  
  79.         location ~ \.php$ {
  80.                 include snippets/fastcgi-php.conf;
  81.                 fastcgi_pass unix:/var/run/php5-fpm.sock;
  82.                 fastcgi_intercept_errors on;
  83.                 fastcgi_buffer_size 128k;
  84.                 fastcgi_buffers 256 4k;
  85.                 fastcgi_busy_buffers_size 256k;
  86.                 fastcgi_temp_file_write_size 256k;
  87.         }
  88.  
  89.         ssl on;
  90.         ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
  91.         ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
  92.         ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
  93.  
  94.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  95.         ssl_prefer_server_ciphers on;
  96.  
  97.         ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:!DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
  98.  
  99.         # https://weakdh.org/
  100.         # openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
  101.         ssl_dhparam /etc/nginx/ssl/dhparam.pem;
  102.  
  103.         # https://trac.nginx.org/nginx/ticket/235
  104.         # nginx vs openssl segfault error, workaround is to be configured at the http{} block level.
  105.         # ssl_session_cache shared:SSL:50m;
  106.         ssl_session_timeout 60m;
  107.  
  108.         ssl_stapling on;
  109.         ssl_stapling_verify on;
  110.         resolver 8.8.8.8 8.8.4.4 valid=86400s;
  111.         resolver_timeout 10s;
  112.  
  113.         add_header Strict-Transport-Security "max-age=31536000; preload";
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement