daily pastebin goal
94%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. location ^~ .(jpg|jpeg|png|gif|ico|css|js)$ {
  2.             expires max;
  3.             valid_referers server_names blocked mysiteaddresishere;
  4.             if ($invalid_referer) {
  5.                return   403;
  6.             }
  7. }
  8.    
  9. location ~ .php$ {
  10.     try_files /a30bc49b5ff24bc50d55ba4306d73470.htm @php;
  11. }
  12.  
  13. location @php {
  14.     try_files $uri =404;
  15.     include /etc/nginx/fastcgi_params;
  16.     fastcgi_pass 127.0.0.1:9010;
  17.     fastcgi_index index.php;
  18.     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  19.     fastcgi_intercept_errors on;
  20. }
  21.    
  22. location /imagehi.php {
  23.         fastcgi_cache MYAPP;
  24.         fastcgi_cache_valid 200 304 404 240h;
  25.         fastcgi_cache_key "method=$request_method|ims=$http_if_modified_since|inm=$http_if_none_match|host=$host|uri=$request_uri";
  26.         fastcgi_hide_header "Set-Cookie";
  27.         fastcgi_ignore_headers "Cache-Control" "Expires";
  28.  
  29.     # or use proxy_* commands if you use Apache, not FastCGI PHP
  30. }
  31.    
  32. fastcgi_cache_key "$scheme$request_method$host$request_uri";
  33.  
  34. server {
  35.     listen *:80;
  36.  
  37.  
  38.     server_name mysite.com www.mysite.com;
  39.  
  40.     root   /var/www/mysite.com/web;
  41.  
  42.  
  43.  
  44.     index index.html index.htm index.php index.cgi index.pl index.xhtml;
  45.  
  46.  
  47.     error_page 400 /error/400.html;
  48.     error_page 401 /error/401.html;
  49.     error_page 403 /error/403.html;
  50.     error_page 404 /error/404.html;
  51.     error_page 405 /error/405.html;
  52.     error_page 500 /error/500.html;
  53.     error_page 502 /error/502.html;
  54.     error_page 503 /error/503.html;
  55.     recursive_error_pages on;
  56.     location = /error/400.html {
  57.  
  58.         internal;
  59.     }
  60.     location = /error/401.html {
  61.  
  62.         internal;
  63.     }
  64.     location = /error/403.html {
  65.  
  66.         internal;
  67.     }
  68.     location = /error/404.html {
  69.  
  70.         internal;
  71.         }
  72.     location = /error/405.html {
  73.  
  74.         internal;
  75.     }
  76.     location = /error/500.html {
  77.  
  78.         internal;
  79.     }
  80.     location = /error/502.html {
  81.  
  82.         internal;
  83.     }
  84.     location = /error/503.html {
  85.  
  86.         internal;
  87.     }
  88.  
  89.     error_log /var/log/ispconfig/httpd/mysite.com/error.log;
  90.     access_log /var/log/ispconfig/httpd/mysite.com/access.log combined;
  91.  
  92.     location ~ /. {
  93.         deny all;
  94.         access_log off;
  95.         log_not_found off;
  96.     }
  97.  
  98.     location = /favicon.ico {
  99.         log_not_found off;
  100.         access_log off;
  101.     }
  102.  
  103.     location = /robots.txt {
  104.         allow all;
  105.         log_not_found off;
  106.         access_log off;
  107.     }
  108.  
  109.     location /stats {
  110.  
  111.         index index.html index.php;
  112.         auth_basic "Members Only";
  113.         auth_basic_user_file /var/www/clients/client0/web1/web/stats/.htpasswd_stats;
  114.     }
  115.  
  116.     location ^~ /awstats-icon {
  117.         alias /usr/share/awstats/icon;
  118.     }
  119.  
  120.     location ~ .php$ {
  121.         try_files /a30bc49b5ff24bc50d55ba4306d73470.htm @php;
  122.     }
  123.  
  124.     location @php {
  125.         try_files $uri =404;
  126.         include /etc/nginx/fastcgi_params;
  127.         fastcgi_pass 127.0.0.1:9010;
  128.         fastcgi_index index.php;
  129.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  130.         fastcgi_intercept_errors on;
  131.     }
  132.  
  133.     location /imagehi.php?=.+.(jpg|jpeg|png|gif) {
  134.         fastcgi_cache MYAPP;
  135.         fastcgi_cache_valid 200 60m;
  136.         # or use proxy_* commands if you use Apache, not FastCGI PHP
  137.     }
  138.  
  139.     location /imagehi.php?=([A-Z]|[0-9]|[a-z]|&)+.(jpg|jpeg|png|gif)$ {
  140.                  expires max;
  141.     }
  142.     location ~ (imagehi.php?=.+.(jpg|jpeg|png|gif))${ {
  143.                  expires max;
  144.     }
  145.     location ^~ .(jpg|jpeg|png|gif|ico|css|js)$ {
  146.                  expires max;
  147.     }
  148.    
  149. // Return the requested graphic file to the browser
  150. // or a 304 code to use the cached browser copy
  151. function displayGraphicFile ($graphicFileName, $fileType='jpeg') {
  152.     $fileModTime = filemtime($graphicFileName);
  153.     // Getting headers sent by the client.
  154.     $headers = getRequestHeaders();
  155.     // Checking if the client is validating his cache and if it is current.
  156.     if (isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) == $fileModTime)) {
  157.  
  158.         // Client's cache IS current, so we just respond '304 Not Modified'.
  159.         header('Last-Modified: '.gmdate('D, d M Y H:i:s', $fileModTime).' GMT', true, 304);
  160.     } else {
  161.         // Image not cached or cache outdated, we respond '200 OK' and output the image.
  162.         header('Last-Modified: '.gmdate('D, d M Y H:i:s', $fileModTime).' GMT', true, 200);
  163.         header('Content-type: image/'.$fileType);
  164.         header('Content-transfer-encoding: binary');
  165.         header('Content-length: '.filesize($graphicFileName));
  166.         readfile($graphicFileName);
  167.     }
  168. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top