Skip to content

Instantly share code, notes, and snippets.

@oschaaf
Created April 17, 2015 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oschaaf/5c4504877db5a132e531 to your computer and use it in GitHub Desktop.
Save oschaaf/5c4504877db5a132e531 to your computer and use it in GitHub Desktop.
nginx + fastcgi_cache + ngx_pagespeed
http {
include mime.types;
default_type application/octet-stream;
pagespeed FileCachePath /tmp/npstmp/;
pagespeed on; # off to test ngx_pagespeed disabled
fastcgi_cache_path /tmp/nginxcache levels=1:2 keys_zone=myzone:1m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
server {
listen 80;
server_name localhost;
root html;
location ~ \.php$ {
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_pass 127.0.0.1:9000;
fastcgi_cache myzone;
fastcgi_cache_valid any 1m;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment