Hi,
We are able to cache html and php files in elastic cache ( memcache ) using srcache in nginx.
However we are not able to get drupal urls to cache. Do we have some kind of documentation which
can help us .
I have attached our config file too .
Thank you,
Vishal
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /opt/nginx/logs/access.log main;
client_max_body_size 50M;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
#gzip_disable "msie6";
#gzip_vary on;
#gzip_proxied any;
#gzip_comp_level 6;
#gzip_buffers 16 8k;
#gzip_http_version 1.1;
#gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype;
upstream my_memcached {
server pro-ca-116xfpr3a8p5y.z7utde.0001.use1.cache.amazonaws.com:11211;
keepalive 10;
}
server {
listen 80;
server_name localhost;
root html/drupalSite;
index index.php;
#root html/drupal;
location /memc {
internal;
set $memc_key $query_string;
set $memc_exptime 86400;
# return 200 $query_string;
memc_pass my_memcached;
}
location / {
# try_files $uri $uri/;
try_files $uri $uri/ @drupal;
index index.php;
# memcache_taher
set $key $uri;
srcache_fetch GET /memc $key;
srcache_store PUT /memc $key;
srcache_store_statuses 200 301 302 304;
# return 200 $uri;
}
location /memc_flush_all {
set $memc_cmd flush_all;
memc_pass my_memcached;
allow 127.0.0.1;
deny all;
}
location /memc_purge {
set $memc_cmd delete;
set $memc_key $args;
memc_pass my_memcached;
allow 127.0.0.1;
deny all;
}
location @drupal {
rewrite ^/(.*)$ /index.php?q=$1 last;
#set $key $uri;
#srcache_fetch GET /memc $key;
#srcache_store PUT /memc $key;
#srcache_store_statuses 200 301 302 304;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
# return 200 $uri;
# memcache_taher
#set $key $uri;
#srcache_fetch GET /memc $key;
#srcache_store PUT /memc $key;
#srcache_store_statuses 200 301 302 304;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
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_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
set $key $uri;
srcache_fetch GET /memc $key;
srcache_store PUT /memc $key;
srcache_store_statuses 200 301 302 304;
}
# Disable viewing .htaccess & .htpassword
location ~ /\.ht {
deny all;
}
}
upstream backend {
server 127.0.0.1:9000;
}
}