Guest User

php-rediscache.conf

a guest
Mar 20th, 2016
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. location ~ \.php$ {
  2. set $key "nginx-cache:$scheme$request_method$host$request_uri";
  3. srcache_fetch_skip $skip_cache;
  4. srcache_store_skip $skip_cache;
  5. srcache_response_cache_control off;
  6. set_escape_uri $escaped_key $key;
  7. srcache_fetch GET /redis-fetch $key;
  8. srcache_store PUT /redis-store key=$escaped_key;
  9. more_set_headers 'X-Cache $srcache_fetch_status';
  10. more_set_headers 'X-Cache-2 $srcache_store_status';
  11. include /usr/local/nginx/conf/503include-only.conf;
  12. try_files $uri =404;
  13. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  14. fastcgi_pass 127.0.0.1:9000;
  15. #fastcgi_pass unix:/tmp/php5-fpm.sock;
  16. fastcgi_index index.php;
  17. #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  18. fastcgi_param SCRIPT_FILENAME $request_filename;
  19. #fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/usr/local/lib/php/:/tmp/;
  20.  
  21. # might shave 200+ ms off PHP requests
  22. # which don't pass on a content length header
  23. # slightly faster page response time at the
  24. # expense of throughput / scalability
  25. #sendfile on;
  26. #tcp_nopush off;
  27. #keepalive_requests 0;
  28.  
  29. fastcgi_connect_timeout 60;
  30. fastcgi_send_timeout 180;
  31. fastcgi_read_timeout 180;
  32. fastcgi_buffer_size 512k;
  33. fastcgi_buffers 512 16k;
  34. fastcgi_busy_buffers_size 1m;
  35. fastcgi_temp_file_write_size 4m;
  36. fastcgi_max_temp_file_size 4m;
  37. fastcgi_intercept_errors on;
  38.  
  39. # next 3 lines when uncommented / enabled
  40. # allow Nginx to handle uploads which then
  41. # passes back the completed upload to PHP
  42. #fastcgi_pass_request_body off;
  43. #client_body_in_file_only clean;
  44. #fastcgi_param REQUEST_BODY_FILE $request_body_file;
  45.  
  46. #new .04+ map method
  47. fastcgi_param HTTPS $server_https;
  48.  
  49. # comment out PATH_TRANSLATED line if /usr/local/lib/php.ini sets following:
  50. # cgi.fix_pathinfo=0
  51. # as of centminmod v1.2.3-eva2000.01 default is set to cgi.fix_pathinfo=1
  52.  
  53. fastcgi_param PATH_INFO $fastcgi_path_info;
  54. fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
  55.  
  56. fastcgi_param QUERY_STRING $query_string;
  57. fastcgi_param REQUEST_METHOD $request_method;
  58. fastcgi_param CONTENT_TYPE $content_type;
  59. fastcgi_param CONTENT_LENGTH $content_length;
  60.  
  61. fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  62. fastcgi_param REQUEST_URI $request_uri;
  63. fastcgi_param DOCUMENT_URI $document_uri;
  64. fastcgi_param DOCUMENT_ROOT $document_root;
  65. fastcgi_param SERVER_PROTOCOL $server_protocol;
  66. fastcgi_param REQUEST_SCHEME $scheme;
  67. fastcgi_param HTTPS $https if_not_empty;
  68.  
  69. fastcgi_param GATEWAY_INTERFACE CGI/1.1;
  70. fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
  71.  
  72. fastcgi_param REMOTE_ADDR $remote_addr;
  73. fastcgi_param REMOTE_PORT $remote_port;
  74. fastcgi_param SERVER_ADDR $server_addr;
  75. fastcgi_param SERVER_PORT $server_port;
  76. fastcgi_param SERVER_NAME $server_name;
  77.  
  78. # Set php-fpm geoip variables
  79. fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
  80. fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
  81. fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
  82. fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
  83. fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
  84. fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
  85. fastcgi_param GEOIP_REGION $geoip_region;
  86. fastcgi_param GEOIP_CITY $geoip_city;
  87. fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
  88. fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
  89. fastcgi_param GEOIP_LATITUDE $geoip_latitude;
  90. fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
  91.  
  92. # PHP only, required if PHP was built with --enable-force-cgi-redirect
  93. fastcgi_param REDIRECT_STATUS 200;
  94.  
  95. }
RAW Paste Data