Need help applying specific PHP Values in Nginx for location within Magento

175 views Asked by At

I need to apply a set of PHP values in an nginx file to prevent Xcache from caching files from a certain extension in Magento. I have successfully done this for magmi as it doesn't work well with Xcache with the following location block.

location ~* ^/magmi/(.*\.php)$ {
    fastcgi_param  PHP_VALUE "xcache.cacher = Off \n 
    xcache.stat = Off \n 
    xcache.size = 0 \n 
    xcache.optimizer = Off \n 
    xcache.coverager = Off";
    expires        off;
    fastcgi_pass   ****coukbackend;
    fastcgi_param  HTTPS $fastcgi_https;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

When I tried to apply the same rules to the directory of the Magento extension it doesn't work and the files are still cached by Xcache

location ~* ^/app/code/community/Ess/(.*\.php)$ {
    fastcgi_param  PHP_VALUE "xcache.cacher = Off \n 
    xcache.stat = Off \n 
    xcache.size = 0 \n 
    xcache.optimizer = Off \n 
    xcache.coverager = Off";
    expires        off;
    fastcgi_pass   ****coukbackend;
    fastcgi_param  HTTPS $fastcgi_https;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

UPDATE **

Since I posted the question I realised that the second location block issue is probably because it is a dynamic url generated by the magento admin which all start like this http://www.****.co.uk/index.php/M2ePro/

1

There are 1 answers

1
Aleksandr On

@TheWebsiteGuy, you should use fastcgi_param PHP_VALUE for every parameters

fastcgi_param  PHP_VALUE "xcache.cacher = Off";
fastcgi_param  PHP_VALUE "xcache.stat = Off";
fastcgi_param  PHP_VALUE "xcache.size = 0";
fastcgi_param  PHP_VALUE "xcache.optimizer = Off";
fastcgi_param  PHP_VALUE "xcache.coverager = Off";