Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

For some reason mod_cache is not working anymore in my setup since Ubuntu 14.04/Apache 2.4.

I reinstalled my complete setup in 2 virtual machines on Ubuntu 12.04 and Ubuntu 14.04 to evaluate if i did everything wrong. But its nearly the same. Just mod_mem_cache isnt configured in Ubuntu 14.04 cause its not available anymore!

The Ubuntu 12.04 is doing fine. While the setup under 14.04 is just not working.

The question is: Which changes need to be done in Ubuntu 14.04 to make mod_cache work again?

Here is my setup:

Ubuntu 14.04 LTS (Server Edition)

I installed:

 apache2-mpm-worker libapache2-mod-fastcgi php5-fpm (and the resulting dependencies...)

I activated the following modules: a2enmod actions alias fastcgi cache cache_disk

Setup the fcgi-fpm like that:

mkdir /var/www/cgi-bin
touch /var/www/cgi-bin/php5.fcgi
chown -R www-data:www-data /var/www/cgi-bin

edited /etc/apache2/mods-enabled/fastcgi.conf:

<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
#FastCgiWrapper /usr/lib/apache2/suexec
FastCgiIpcDir /var/lib/apache2/fastcgi
Alias /php5.fcgi /var/www/cgi-bin/php5.fcgi
AddType application/x-httpd-fastphp5 .php
Action application/x-httpd-fastphp5 /php5.fcgi
FastCGIExternalServer /var/www/cgi-bin/php5.fcgi -socket /var/run/php5-fpm.sock
<Directory "/var/www/cgi-bin">
Order allow,deny
<Files "php5.fcgi">
Order deny,allow
</Files>
</Directory>
</IfModule>

No big changes on the default virtual host settings.

I changed the vi /etc/apache2/mods-available/disk_cache.conf to the following:

<IfModule mod_cache_disk.c>

# cache cleaning is done by htcacheclean, which can be configured in
# /etc/default/apache2
#
# For further information, see the comments in that file,
# /usr/share/doc/apache2/README.Debian, and the htcacheclean(8)
# man page.

# This path must be the same as the one in /etc/default/apache2
CacheRoot /var/cache/apache2/mod_cache_disk

# This will also cache local documents. It usually makes more sense to
# put this into the configuration for just one virtual host.
CacheEnable disk /


# The result of CacheDirLevels * CacheDirLength must not be higher than
# 20. Moreover, pay attention on file system limits. Some file systems
# do not support more than a certain number of inodes and
# subdirectories (e.g. 32000 for ext3)
# CacheDirLevels 2
CacheDirLevels 5
# CacheDirLength 1
CacheDirLength 3

</IfModule>

For testing i created a php file:

vi /var/www/test/cachetest.php

<?php
header("Cache-Control: must-revalidate, max-age=300");
header("Vary: Accept-Encoding");
echo time()."<br>";
?>This is printing the timestamp.

Now I call that file in a browser - it displays the current time stamp. While testing this on a Ubuntu 12.04 LTS and clicking in the browers adress bar and pressing ENTER so that the page gets loaded (wont work with F5! - cause this will fetch a fresh copy from the server instead of the cache) - i still see the old, cached timestamp. On Ubuntu 14.04 LTS this just wont work.

How do I need to change the configuration files to make mod_cache work in my setup?

Kind regards Cybearg

share|improve this question
    
Cybearg, welcome to the community. Your question is pretty well formatted except for the fact that it's just a tad unclear what you're asking. I'd assume from the first line where you said "For some reason mod_cache is not working anymore in my setup since Ubuntu 14.04/Apache 2.4." that would be what you need help with, but perhaps consider editing the question at the bottom to reflect that. –  Brad Bouchard May 20 at 14:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.