I had failed attempts earlier at getting Nginx Fast-CGI caching to work in Nginx > Apache > PHP-FPM
config so I started fresh on a new server but am still having issues.
The server has a clean Ubuntu 16.04
install with Nginx 1.14.2
, Apache 2.4.18
and PHP-FPM 5.6
(just for testing sake).
My /etc/nginx/nginx.conf
config is stock as I've only made changes in vhost (anything outside server block is effectively nginx.conf
).
My apache2 test.mysite.com.conf is
<VirtualHost 127.0.0.1:8080>
ServerName test.mysite.com
DocumentRoot /var/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php/php5.6-fpm.sock|fcgi://localhost/var/www/
</VirtualHost>
To test caching, I have following in /var/www/cachetest.php
<?php
echo time();
?>
However testing http://test.mysite.com/cachetest.php
changes every second and consequently /etc/nginx/cache
is always empty (its 777
for now).
Any ideas why cache isn't working?