= 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 [https://www.varnish-cache.org/about 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 [http://pressflow.org/ Pressflow] distribution. * Drupal 7: According to [http://blogs.osuosl.org/gchaix/2011/01/05/drupal-7-varnish/ 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 [https://drupal.org/node/1196916#comment-4655090 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 [https://drupal.org/project/varnish 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 [http://www.isvarnishworking.com/ 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 [/newticket open a new ticket explaining what you need to happen]. '''NOTE:''' The below instructions are not quite correct, will be updated soon. * Create a new vcl file for the domain, i.e. `/etc/varnish/vhosts/domain-name.vcl` * Copy the format of a current vcl file, depending on the CMS. * Add an include line in `/etc/varnish/vhosts/vhosts-list.vcl` for the file you created above. * run `/etc/init.d/varnish reload` '''NOTE:''' The above instructions should ultimately become a part of puppet or red.