Version 8 (modified by 11 years ago) (diff) | ,
---|
NOTE: This documentation is out of date.
Shared Varnish Caching
If you find that your site runs slowly and you've turned on all the CMS specific caching features available to you, it might be time to use our shared varnish server. Varnish helps manage higher traffic websites by creating a cache of all the previous page loads and serving them up with a minimal amount of processing. In order to hook into our shared varnish instance, you'll need to make some changes to your DNS entries, and a support team member will need to add a file to our varnish server (currently dolores.mayfirst.org).
Changing DNS Entries
Visit the control panel and the hosting order that should use varnish caching. Change the DNS entry for the appropriate domains. For example, you might want
Domain Name | IP Address |
example.org | 209.51.180.234 |
www.example.org | 209.51.180.234 |
example.com | 209.51.180.234 |
www.example.com | 209.51.180.234 |
example.mayfirst.org | doesn't change |
Notice that the last entry example.mayfirst.org
did not change. This domain can serve as a direct link to the server in case anything goes awry.
Modify Your Config Files
Some CMS's require you to modify your configuration files. You should check to make sure you have the correct configurations set.
For Mediawiki
In your LocalSettings.php, you'll need to add the following:
$wgUseSquid = true; $wgSquidServers = array('209.51.180.234:80');
For Drupal
- Drupal 6 requires the Pressflow distribution.
- Drupal 7: According to Propeller-heads Unite!, you may need to add the following to your settings.php file:
# Tell Drupal it's behind a proxy $conf['reverse_proxy'] = TRUE; # Tell Drupal what addresses the proxy server(s) use $conf['reverse_proxy_addresses'] = array('209.51.180.234');
You may also want these additional variables set from drupal.org
$conf['page_cache_invoke_hooks'] = false; $conf['cache'] = 1; $conf['cache_lifetime'] = 0; $conf['page_cache_maximum_age'] = 21600; $conf['reverse_proxy_header'] = 'HTTP_X_FORWARDED_FOR'; $conf['omit_vary_cookie'] = true;
Additionally, the Drupal varnish plugin provides added functionality.
Wordpress
You shouldn't need to take any special steps for wordpress caching. Though please make sure to turn off W3 Total Cache before using our shared varnish server.
Testing
To see if Varnish is working, type your domain into the Is Varnish Working site.
Support Team
Our current varnish server is dolores.mayfirst.org
. A support team member needs to make the following configuration changes for each new hosting order. If you need these changes made and you aren't a member of the support team, please open a new ticket explaining what you need to happen.
- In your puppet configuration puppet/modules/mayfirst/files/varnish
- Create a new vcl file for the domain, i.e.
/etc/varnish/VARNISH_SERVER_NAME/domain-name.vcl
- Copy the format of a current vcl file, depending on the CMS. The include lines will vary depending on the CMS. We currently have default varnish files for wordpress and drupal.
- Make the needed changes to the file which should be the line that references the domain, make sure the domain is accurate. In the example below "occupychicago\.org" should read "YOUR_DOMAIN_NAME\.org".
sub vcl_recv { if (req.http.host ~ "^(www\.)?chicagospring\.org" ) { include "/etc/varnish/dolores/drupal-includes/drupal-recv.vcl"; } }
- Add an include line in
/etc/varnish/VARNISH_SERVER_NAME/vhosts-list.vcl
for the file you created above. - When your changes are complete commit them to the repository and do git push SERVER_NAME or freepuppet-helper gp:SERVER_NAME.
- Make sure to follow the puppet output for any errors.
NOTE 0: We currently have not worked out a way for varnish to work across multiple servers. So the above method will only work with a single guest server, at the time of this writing kerr.mayfirst.org. Hopefully we'll be able to support multiple guests soon.
NOTE: The above instructions should ultimately become a part of puppet or red.