-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I wrote these out as I just set this up, could help others. Thanks,
Where to begin with statcache and overview of the setup process.
- Install via Package Manager
- Go to the plugin and attach the correct System events: https://github.com/opengeek/statcache/wiki/StaticCache-Plugin
- There are no system settings just Properties to configure statecache: http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/properties-and-property-sets#PropertiesandPropertySets-AssigningPropertySetstoElements
- Now clear cache and go to a few pages that are cachable. Note if using default settings there must not be any none cachable snippets/chunks/placeholders on the page. ex: [[!mySnippet]]
- Check the statcache directory at the root of your MODX install for files that are written to this folder. If the folder does not exist, create it and make sure PHP can write and modify it. statcache is the default directory.##Now you are ready to add to the .htaccess rules
- If you are using urls without the .html then you will need to add an .htaccess file to your
statcache directory. Review: https://github.com/opengeek/statcache/wiki#web-server-configuration-issues for complete details - If you are running on NGINX review: https://github.com/opengeek/statcache/wiki#web-server-configuration-for-nginx
- If you are running on Apache
- Open up your .htaccess file that does your MODX friendly URLs. This is most likely in the root of your MODX install.
- Add the appropriate rules just before the MODX SEF, those will look like this:
# Add statcache rules Here
# END statcache
# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Review rules: https://github.com/opengeek/statcache/wiki#web-server-configuration-for-apache
Rewrite cheat sheet: http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html
RewriteCond cheat sheet: http://www.askapache.com/htaccess/rewritecond-cheatsheet.html
500 errors, if you have cPanel then go to Logs -> Error Log and there may be a message in there.
Note I did not get the rules in wiki to work with my shared hosting that runs on apache. Here is what I ended up writing:
# Start statcache
RewriteCond %{DOCUMENT_ROOT}/statcache/%{REQUEST_URI}~index.html -f
RewriteRule ^(.*)$ statcache%{REQUEST_URI}~index.html [L,QSA]
RewriteCond %{DOCUMENT_ROOT}/statcache%{REQUEST_URI} -f
RewriteRule ^(.*)$ statcache%{REQUEST_URI} [L,QSA]
# END statcache
Metadata
Metadata
Assignees
Labels
No labels