Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.97 KB | None | 0 0
  1. server {
  2.     listen 80;
  3.     server_name example.com;
  4.     root /var/www/example.com/public/;
  5.  
  6.     ssl_protocols TLSv1.2;
  7.  
  8.     index index.html index.htm index.php;
  9.  
  10.     charset utf-8;
  11.  
  12.     # Dynamically set the try_files locations.
  13.     # Statically cached files should only be loaded for GET requests.
  14.     set $try_files @default;
  15.     if ($request_method = GET) {
  16.         set $try_files @static;
  17.     }
  18.  
  19.     # The files to try when its a potentially static cache request (ie. a GET request)
  20.     location @static {
  21.         try_files /static${uri}_${query_string}.html @default;
  22.     }
  23.  
  24.     # The files to try when it's not a static cache request (ie. anything other than GET)
  25.     location @default {
  26.         try_files $uri $uri/ /index.php?$query_string;
  27.     }
  28.  
  29.     location / {
  30.         try_files $uri $try_files; # Use the dynamically assigned locations from above.
  31.     }
  32.  
  33.     location = /favicon.ico { access_log off; log_not_found off; }
  34.     location = /robots.txt  { access_log off; log_not_found off; }
  35.  
  36.     access_log off;
  37.     error_log  /var/log/nginx/example.com-error.log error;
  38.  
  39.     error_page 404 /index.php;
  40.  
  41.     location ~ \.php$ {
  42.         fastcgi_split_path_info ^(.+\.php)(/.+)$;
  43.         fastcgi_pass unix:/var/run/php5-fpm.sock;
  44.         # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  45.         fastcgi_index index.php;
  46.         include fastcgi_params;
  47.     }
  48.  
  49.     # Block access to hidden files (except the /.well-known/ dir)
  50.     location ~ /(?!.well-known)(\.)\w+ {
  51.         deny all;
  52.     }
  53.  
  54.     # Block access to content/data files
  55.     location ~* /(.*)\.(?:md|yaml|textile)$ {
  56.         deny all;
  57.         return 404;
  58.     }
  59.  
  60.     # Block access to the Statamic app
  61.     location ^~ /statamic {
  62.         deny all;
  63.         return 404;
  64.     }
  65.  
  66.     # Enable gzip compression
  67.     # gzip on;
  68.     # gzip_min_length  1100;
  69.     # gzip_buffers  4 32k;
  70.     # gzip_types    text/plain application/x-javascript text/xml text/css;
  71.     # gzip_vary on;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement