Re: Apache proxy keeps cache directory empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 15.04.2016 um 23:02 schrieb Bjoern Voigt:
Since some years I run a local Apache proxy cache for localhost and the
192.168.1.0/24 network. My proxy cache directory /var/cache/apache-proxy
is cleaned by a htcacheclean weekly cron job.

In the meantime Apache stopped writing files in my cache directory
/var/cache/apache-proxy. The proxy function still works.

I doubt, that an Apache update with configuration directive changes may
have caused the problem. But I don't know after which event Apache
stopped caching.

Here is my Apache proxy configuration. I verified, that the modules
mod_proxy and mod_cache_disk are loaded, e.g. by making temporary syntax
errors between the "IfModule" directives and "apachectl configtest".
- Distribution: openSUSE Tumbleweed
- Apache 2.4.20
- /etc/apache2/conf.d/proxy.conf:
<IfModule
mod_proxy.c>

         ProxyRequests On
         ProxyVia On
         AllowCONNECT 443

         <Proxy *>
           Require ip 192.168.1.0/255.255.255.0 127.0.0.0/255.0.0.0 ::1
         </Proxy>
</IfModule>

<IfModule mod_cache.c>
<IfModule mod_cache_disk.c>
         CacheRoot /var/cache/apache-proxy
         CacheEnable disk /
         CacheDirLevels 2
         CacheDirLength 2
</IfModule>
</IfModule>

How can I debug the problem?
(Btw. "strace" shows, that the cache configuration directory
/var/cache/apache-proxy is never touched by Apache.)

First personally I don't like the use of IfModule. That is a nice feature, if you want to be flexible in turning on or of functional blocks. But if you have a more rigid configuration and you need a feature, why enclose it in IfModule? If the module really isn't loaded, you like a clear startup error, that tells you about CacheRoot directive isn't known etc. and not instead just load without having the cache enabled. So I suggest removing the IfModule directives (assuming that the proxy and cache features are not just optional for you).

Can you see the two level directory structure for the cache underneath /var/cache/apache-proxy? Are ownerships and permissions OK?

For further debugging you can:

- Add

%{cache-hit}e %{cache-revalidate}e %{cache-miss}e %{cache-invalidate}e %{no-cache}e

to the LogFormat that you are using in your CustomLog definition (access log)

- Add "CacheDetailHeader on" to the config and look at the response header "X-Cache-Detail" which tells you about the caching decision and reasons.

- Increase the log level of mod_cache and mod_cache_disk via

 LogLevel warn cache:trace8 cache_disk:trace8

Depending on your request load and cache activity this might result in lots of error log output.

- Have a look for mod_cache and mod_cache_disk entries for the time between your newest working version and the broken one in CHANGES:

  http://www.apache.org/dist/httpd/CHANGES_2.4

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux