Advertisement
Guest User

nginx.conf

a guest
Dec 26th, 2019
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.37 KB | None | 0 0
  1. server {
  2.     listen         80 default_server;
  3.     listen         [::]:80 default_server;
  4.     server_name    example.com www.example.com;
  5.     root           /var/www/example.com;
  6.     index          index.php;
  7.     try_files $uri /index.php;
  8.    
  9.     add_header X-XSS-Protection "1; mode=block";
  10.     add_header X-Frame-Options SAMEORIGIN;
  11.     add_header X-Content-Type-Options nosniff;
  12.    
  13.     location ~* \.(woff2|woff|ttf|otf|svg)$ {
  14.         add_header Access-Control-Allow-Origin *;
  15.     }
  16.  
  17.     location / {
  18.         autoindex on;
  19.        
  20.         if ($request_uri ~* ".(gif|jpe?g|png|webp|svg|mp4|mpeg)$") {
  21.             expires 365d;
  22.             access_log off;
  23.             add_header Pragma public;
  24.             add_header Cache-Control "public";
  25.             break;
  26.         }
  27.        
  28.         if ($request_uri ~* ".(css|js|pdf|swf)$") {
  29.             expires 30d;
  30.             access_log off;
  31.             add_header Pragma public;
  32.             add_header Cache-Control "public";
  33.             break;
  34.         }
  35.     }
  36.    
  37.     gzip on;
  38.     gzip_disable "msie6";
  39.     gzip_vary on;
  40.     gzip_proxied any;
  41.     gzip_comp_level 6;
  42.     gzip_buffers 16 8k;
  43.     gzip_http_version 1.1;
  44.     gzip_types application/javascript application/rss+xml application/vnd.ms-fontobject application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/opentype font/otf font/ttf image/svg+xml image/x-icon text/css text/javascript text/plain text/xml;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement