Forums / Install & configuration / 3.6 : Static Cache for siteaccesses

3.6 : Static Cache for siteaccesses

Author Message

Antoine W.

Tuesday 31 May 2005 3:11:07 am

Hello,

I'm trying to set up Static Caching, but I cant have it working with our siteaccesses for the moment.
I have followed these instructions : http://www.ez.no/ez_publish/download/changelogs/ez_publish_3_6/new_features/static_caching_of_content

But when I run "php bin/php/makestaticcache.php -s fr", or "php bin/php/makestaticcache.php -f", no files are generated and I have following errors in Apache's logs :

[Tue May 31 12:18:50 2005] [error] [client 192.168.100.86] File does not exist: /var/www/webdev/ez/fr
[Tue May 31 12:18:50 2005] [error] [client 192.168.100.86] File does not exist: /var/www/webdev/ez/en

It seems to try to write static cache on a bad location. Static files should be writtein in /var/www/webdev/ez/static.
I have created this directory with needed permissions, and created subfolders "fr" and "en".

Here is my configuration. I have two siteaccess : "fr" and "en"

DocumentRoot is set to /var/www/webdev/ez

---------------------
.htaccess
---------------------
RewriteEngine On
RewriteRule !\.(gif|jpe?g|png|css|js|html)|var(.+)storage.pdf(.+)\.pdf$ index.php

#STATIC CACHING
RewriteCond /var/www/webdev/ez/static/en/index.html -f
RewriteRule ^/$ /static/en/index.html [L]
RewriteCond /var/www/webdev/ez/static/en/index.html -f
RewriteRule ^$ /static/en/index.html [L]

RewriteCond /var/www/webdev/ez/static/fr/index.html -f
RewriteRule ^/$ /static/fr/index.html [L]
RewriteCond /var/www/webdev/ez/static/fr/index.html -f
RewriteRule ^$ /static/fr/index.html [L]

RewriteCond %{REQUEST_METHOD} !^POST$
RewriteCond /var/www/webdev/ez/static$1/index.html -f
RewriteRule ^(.*)$ /static$1/index.html [L]

--------------------
settings/override/site.ini.append.php :
--------------------
[ContentSettings]
StaticCache=enabled

--------------------
settings/siteaccess/en/staticcache.ini.append.php :
--------------------
[CacheSettings]
StaticStorageDir=static/en

--------------------
settings/siteaccess/fr/staticcache.ini.append.php :
--------------------
[CacheSettings]
StaticStorageDir=static/fr

--------------------
settings/override/staticcache.ini.append.php
--------------------
[CacheSettings]
HostName=localhost
MaxCacheDepth=4

# A list of url's to cache
CachedURLArray[]
CachedURLArray[]=/*

AlwaysUpdateArray[]
AlwaysUpdateArray[]=/
AlwaysUpdateArray[]=/products

CachedSiteAccesses[]
CachedSiteAccesses[]=en
CachedSiteAccesses[]=fr

Thanks for any help

David Goddard

Wednesday 01 June 2005 7:33:59 am

Hi Antoine

I really struggled with Static Caching but did get it to work in the end (but not with multiple site translations as you have).

I can't see what is wrong with your config, but I would suggest turning on rewrite logging. It helped me a lot.

RewriteLog /tmp/rewrite
RewriteLogLevel 4

David

Frederik Holljen

Wednesday 01 June 2005 10:00:15 am

Due do a bug we discoverd right before the release we had to change some of the static caching code. Unfortunately the script building the static cache was not fixed properly (both from CLI and from the admin interface).
The trivial patch can be found here: http://svn.ez.no/comp.php?repname=ezpublish&path=&compare%5B%5D=%2Fstable%2F3.6@12099&compare%5B%5D=%2Fstable%2F3.6@12100&manualorder=1

If you view the pages that should be statically cached, the cache should be generated as normal.

Antoine W.

Friday 03 June 2005 2:38:29 am

Thanks, I grabbed new files from SVN and it works fine now ! =)

Just a suggestion about rewriterules, with configuration in example Apache tries to find static html files for each element of pages (css, images...).
To avoid this, I simply added following condition :

[...]
<b>RewriteCond %{REQUEST_URI} !\.(gif|css|jpg|png|jar|ico|js|html)$</b>
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteCond /var/www/webdev/ez/static$1/index.html -f
RewriteRule ^(.*)$ /static$1/index.html [L]

I dont know if it's really faster, but logs are more clean :)

Erik Streb

Saturday 09 July 2005 9:22:38 am

Hello Frederik Holljen.

Where can I find out which version exactly I'm using? I downloaded it yesterday. Do I have to patch it still or not?

Thanks for your answer.

PS: I know I could just watch in the php-files that one should patch, to know if I still have to. But I want to know where I can find out the exact version of my eZpublish.

Frederik Holljen

Saturday 09 July 2005 9:46:02 am

If you go to the setup tab in the administration interface one of the options displays some system information. The latest released version still needs to be patched. An updated version will be released soon.

Erik Streb

Saturday 09 July 2005 10:06:15 am

Ok.

Ah, and a second question:
Why are there some empty ending definitions in settings/override/staticcache.ini.append.php ?
CachedURLArray[] <----- THIS ONE
CachedURLArray[]=/*

AlwaysUpdateArray[] <----- THIS ONE
AlwaysUpdateArray[]=/
AlwaysUpdateArray[]=/products

CachedSiteAccesses[] <----- THIS ONE
CachedSiteAccesses[]=en
CachedSiteAccesses[]=fr

Its the same in the official description:
http://ez.no/ez_publish/download/changelogs/ez_publish_3_6/new_features/static_caching_of_content
Is this correct?

Frederik Holljen

Saturday 09 July 2005 10:23:36 am

The empty lines are used for array settings to clear the array. E.g
foo[]=1
foo[]=2
foo[]=3
Yields the array 1,2,3 while:
foo[]=1
foo[]=2
foo[]
foo[]=3
gives you an array containing only 3.

This is useful when overriding settings and you want to make sure that the array is empty before you add your stuff.

Erik Streb

Saturday 09 July 2005 11:04:29 am

Ok, thank you very much.
Then someone should change the example in http://ez.no/ez_publish/download/changelogs/ez_publish_3_6/new_features/static_caching_of_content at "Set-up With One Site Acccess" from

# A list of url's to cache
CachedURLArray[]=/*

to

# A list of url's to cache
CachedURLArray[]
CachedURLArray[]=/*

Only to be correct. Hmm...ok I know it doesn't matter, because /* is EVERYTHING and other array-entries doesn't change anything in EVERYTHING. But it confused me.