Skip to main content

mod_cache not creating cache files?

Comments

5 comments

  • cPanelMichael
    Hello @User8472, It looks like the issue might relate to the custom entry you are using under the "Pre Main Include" section. Here are the steps I took when testing with a standard configuration: 1. Install the required RPMs: yum install ea-apache24-mod_cache ea-apache24-mod_cache_disk
    2. Create the cache storage directory: mkdir /var/cache/apache2/mod_cache/ chmod 0700 /var/cache/apache2/mod_cache chown nobody.nobody /var/cache/apache2/mod_cache/
    3. Add the following entry to the "Pre Main Include" section in "WHM >> Apache Configuration >> Include Editor": CacheQuickHandler Off # Must be writable by apache 700 nobody:nobody CacheRoot /var/cache/apache2/mod_cache/ CacheEnable disk / CacheDirLevels 2 CacheDirLength 1 # X-Cache: [HIT|MISS] # CacheHeader on
    4. Create /home/username/public_html/cache.php with the following contents:
    5. Open $domain.tld/cache.php in a web browser. 6. Confirmed the cache files were generated in in the /var/cache/apache2/mod_cache/ directory: # pwd /var/cache/apache2/mod_cache/Q/Y # ls -al total 4 drwx------ 3 nobody nobody 81 Apr 25 09:46 . drwx------ 3 nobody nobody 15 Apr 25 09:46 .. -rw------- 1 nobody nobody 31 Apr 25 09:46 ye5IIyK6mE2K1mVMw7kw.header drwx------ 3 nobody nobody 15 Apr 25 09:46 ye5IIyK6mE2K1mVMw7kw.header.vary
    Thank you.
    1
  • User8472
    Thanks for the reply. It turns out that the CacheLock on in my original example was preventing the cache files from being created. Just commenting out that line enabled the cache files to be generated - not sure why though, it's a valid directive according to the apache documentation. Unfortunately, both my example and the example you provided produce unexpected results on the Wordpress site. Seemingly random files are served up using either configuration (the homepage seems fine, but further navigation produces unexpected content). But that's a separate issue. Also a quick question regarding your example. Shouldn't the CacheQuickHandler off be in a separate section as below? CacheQuickHandler off
    Or am I misunderstanding how the cache directives are handled? Can directives from the cache_module be included in the cache_disk_module section? Apache doesn't complain either way. Thanks again for your help!
    0
  • cPanelMichael
    Also a quick question regarding your example. Shouldn't the CacheQuickHandler off be in a separate section as below?

    Hello, Yes, it's a directive of cache_module so it's generally better if it's part of the "" statement. That said, it should still work in either case in this instance because both of those Apache modules are enabled on the system. Any valid configuration value added to IfModule statements should work as long as that particular Apache module is enabled, even if it's not a directive of that particular module. This is documented in more detail at:
    0
  • sahostking
    Unfortunately, both my example and the example you provided produce unexpected results on the Wordpress site. Seemingly random files are served up using either configuration (the homepage seems fine, but further navigation produces unexpected content). But that's a separate issue.

    I am getting this now. How did you solve this?
    0
  • sahostking
    Could be this :
    0

Please sign in to leave a comment.