Boost your Drupal site!
Oct 25, 2010
If your Drupal site has mostly anonymous traffic, then Boost is certainly a module you would like to install. It caches all static pages. When anonymous users open a content page, Drupal doesn’t have to pull data from the database to render the page, it literally turns it to a static html file in the first visit. The rest of the visitors will pull the html file. This post assumes you are using a Linux box to host your site.
To have Boost working, you need to follow five steps:
- Install Module
- Modify robots.txt file
- Create cache folders
- Add the rewrite rules to the .htaccess
- Set up cron
So first, download and install Boost on your Drupal site, we then need to configure it.
You can use the status report as a guideline. Go to the admin/reports/status page in your site and you will see all the pending actions that need to be done to make this module work.
The second step is to prevent web crawlers from indexing the output of the module in certain files. So we add the following line at the end of the robots.txt file, located in the root folder of your Drupal site:
Disallow: /boost_stats.php
Next we need to create the following nested folders in your root directory:
cache/perm/[yoursite.com]
Make sure you replace [yoursite.com] with your site's real domain. Now give the folders you created writing access to apache by running the "chmod" command from the root folder:
chmod -R 777 cache
The fourth step is to add the rewrite rules in your .htaccess file. Login as the admin in your site and go to Site configuration > Performance > Boost htaccess rule generation. Copy that code and paste it at the bottom of your .htaccess file. This file is located in your root directory as well.
The final step is setting up cron, which is really easy and you might already have this set up. If you don't have cron set up, then first log in to the server using an admin account (not root). Then edit crontab with the following command:
sudo crontab -e
Add the following new line:
0 * * * * wget -O - -q -t 1 http://yoursite.com/cron.php
What we are doing here is telling cron to execute a command every hour, thats all we need in our case. The command is to make an http request to the cron.php file in our site. You will need of course to replace the yoursite.com value for your real domain. For additional help on setting up cron, go to http://drupal.org/cron.
Now restart apache and test your site. Check that friendly URLs are still working. Also, check the cache/perm/[yoursite.com] folder you created before, if there are files there it means Boost is working fine! You have successfully implemented the Boost caching system. If not, go back to make sure all steps were completed. Make sure that cron is running as well, you do that by checking the Drupal status report page on your site (admin/reports/status). Use the documentation that Boost provides in their project page to guide you or post any questions here and I will be happy to answer them.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.