Advertisement
MertcanGokgoz

Piwik with SSL NGINX Config

Mar 14th, 2019
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.02 KB | None | 0 0
  1. server {
  2.     listen 443 ssl http2;
  3.     listen [::]:443 ssl http2;
  4.  
  5.     server_name analytics.mertcangokgoz.com;
  6.     set $base /var/www/mertcangokgoz.com;
  7.       root $base/piwik;
  8.  
  9.     # SSL
  10.     ssl_session_timeout 1d;
  11.     ssl_session_cache shared:SSL:50m;
  12.     ssl_session_tickets off;
  13.  
  14.     # modern configuration
  15.     ssl_protocols TLSv1.2;
  16.     ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256;
  17.     ssl_prefer_server_ciphers on;
  18.  
  19.     # OCSP Stapling
  20.     ssl_stapling on;
  21.     ssl_stapling_verify on;
  22.     resolver 1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s;
  23.     resolver_timeout 2s;
  24.  
  25.     ssl_certificate /etc/letsencrypt/live/sitem.com/fullchain.pem;
  26.     ssl_certificate_key /etc/letsencrypt/live/sitem.com/privkey.pem;
  27.  
  28.     add_header Strict-Transport-Security max-age=15768000;
  29.     client_max_body_size 50M;
  30.  
  31.     index index.html index.htm index.php;
  32.  
  33.     charset utf-8;
  34.     index index.php;
  35.     location / {
  36.       try_files $uri $uri/ /index.php?$args;
  37.     }
  38.  
  39.     location ~ /\.(?!well-known) {
  40.       deny all;
  41.     }
  42.  
  43.     # assets, media
  44.     location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
  45.       expires 7d;
  46.       access_log off;
  47.     }
  48.  
  49.     # svg, fonts
  50.     location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
  51.       add_header Access-Control-Allow-Origin "*";
  52.       expires 7d;
  53.       access_log off;
  54.     }
  55.  
  56.     location ~ /\.ht {
  57.       deny  all;
  58.     }
  59.  
  60.     location ~ \.php$ {
  61.       fastcgi_index index.php;
  62.       fastcgi_keep_conn on;
  63.       include /etc/nginx/fastcgi_params;
  64.       #fastcgi_pass 127.0.0.1:9000;
  65.       fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  66.       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement