Forum

Directory caching doesn't seem to be working...

Rob Zamites
8 December 2016, 03:45
Hello all,

I'm new to Hiawatha, and must say I love it! Well, except for this one thing; I'm trying to implement caching using Directory entries thus:

=======================================
VirtualHost {
Hostname = xxx.domain.net, *.xxx.domain.net
WebsiteRoot = /home/xxx/public_html
UseDirectory = cache-control-1w, cache-control-2w, cache-control-2m
StartFile = index.php
AccessLogfile = /var/log/hiawatha/vhosts/xxx/access.log
ErrorLogfile = /var/log/hiawatha/vhosts/xxx/error.log
TimeForCGI = 60
UseFastCGI = PHP5
CustomHeader = X-Frame-Options: sameorigin
CustomHeader = Vary: Accept-Encoding
RandomHeader = 64
UseToolkit = wordpress
EnforceFirstHostname = yes
PreventXSS = yes
PreventCSRF = yes
PreventSQLi = yes
}
=======================================


and the following Directory stanzas:

=======================================
Directory {
DirectoryID = cache-control-1w
Path = /home/xyz/wp/, /home/xxx/public_html/
Extensions = gif, htm, html, jpeg, jpg, png
ExpirePeriod 1 week
}

Directory {
DirectoryID = cache-control-2w
Path = /home/xyz/wp/, /home/xxx/public_html/
Extensions = css, js, svg, swf, ttf, txt
ExpirePeriod 2 weeks
}

Directory {
DirectoryID = cache-control-2m
Path = /home/xyz/wp/, /home/xxx/public_html/
Extensions = eot, ico, otf, pdf, ps, psd ttf, woff, woff2
ExpirePeriod 2 months
}
=======================================


I absolutely cannot get GTMetrix or any other site testing place to accept the fact that I have caching enabled. It's getting frustrating as all get out. I won't even get into the Gzip stuff yet

Any hints or insight is appreciated.

Rob
Nicolas
8 December 2016, 10:16
Hello,

If I'm understanding correcty, you are defining the path relative to the root of your server's files system : the path is relative to the root of your website. And directories inherit the rules from their parents.

Using this code should work for all you website :
Directory {
DirectoryID = cache-control-1w
Path = /
Extensions = gif, htm, html, jpeg, jpg, png
ExpirePeriod 1 week
}

Directory {
DirectoryID = cache-control-2w
Path = /
Extensions = css, js, svg, swf, ttf, txt
ExpirePeriod 2 weeks
}

Directory {
DirectoryID = cache-control-2m
Path = /
Extensions = eot, ico, otf, pdf, ps, psd ttf, woff, woff2
ExpirePeriod 2 months
}

Gzip should work « automagically ». Hugo talked about it here [www.hiawatha-webserver.org] :
The good thing about the new approach is that it doesn't require any configuration. If the browser tells the webserver that it supports compression, it will be used.
Rob Zamites
9 December 2016, 21:42
Hello Nicholas,

Thank you - I will give that a try and see how it goes!

~Rob
This topic has been closed.