Afternoon all,
I've used this module before with other CMS's with great success, but for the life of me I cannot get Nginx to cache anything from a Moodle installation. I am fairly certain this is due to the Slash Arguments (
https://docs.moodle.org/dev/Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm#Moodle) function it uses. I believe this since, if I go to a file directly that doesn't come from that (say, README.txt), I see in the log that the request is cached, and I see subsequent requests in memcached return as get_hit's. For the life of me, however, I am unable to get Moodle and this mod
ule to play nicely and cache requests for things I direct it to, no matter what hodgepodge of rewrite rules and configurations I use. For reference, I've included my configuration lines below:
server {
error_log /var/log/nginx/domain.com.err info;
access_log /var/log/nginx/domain.com.log combined;
listen 80;
server_name domain.com www.domain.com;
root /var/www/moodle;
index index.php;
rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;
location / {
try_files $uri $uri/ $uri/index.php /index.php?$args;
}
location ~* \.(?:ico|html?|txt|js|css|ttf|svg|woff2?|eot|xml|docx?|xlsx?|pdf)$ {
set $key $uri$args;
srcache_fetch GET /memc $key;
srcache_store PUT /memc $key;
srcache_store_statuses 200 301 302;
try_files $uri =404;
}
location /memc {
internal;
memc_connect_timeout 100ms;
memc_send_timeout 100ms;
memc_read_timeout 100ms;
memc_ignore_client_abort on;
set $memc_key $query_string;
set $memc_exptime 300;
memc_pass unix:/var/run/memcached/memcached.sock;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
fastcgi_pass unix:/var/run/fpm.sock;
fastcgi_index index.php;
}
location ~ /\.ht {
deny all;
}
}
Example of a request that is not cached, but I believe should be:
[04/Oct/2015:13:20:17 -0400] "GET /theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple-min.css HTTP/1.1" 200 1043
Example of a request that is cached:
[04/Oct/2015:13:27:34 -0400] "GET /README.txt HTTP/1.1" 200 760
Versions of software:Nginx: 1.9.5
PHP: 5.6.13
memc-nginx-module: 0.16
srcache-nginx-module: 0.30
OS: CentOS 7.1.1503
Any assistance on getting this all to work correctly (if at all possible) would be appreciated.
Thanks.