A lot of the tutorials published here at OSTraining are solutions to specific problems.
But, how can you keep your site healthy on a daily basis? I'm going to give you some advice on how to maintain your site.
These four steps will help you understand what can go wrong with your Drupal site, and where to start looking for solutions if you have an issue.
#1. Check the Status Report screen
Drupal provides a feature called a Status Report which checks a variety of important issues regarding your site's health, including permissions of the folders that Drupal needs to access. Modules that aren’t working because of other modules or libraries they need that are not installed will also be printed here.
This video from the "Installing Drupal 8" class explains more about the Status Report:
#2. Make sure Cron is running
Cron should definitely be running on your Drupal site in order to keep it healthy. Cron helps with scheduled tasks like clearing the cache, running jobs like e-mails for example reminders etc.
While it is best to call cron externally, according to the Drupal install.txt file (see Step #8 here), most people do not do this. You should ask a prospective host whether they support cron, and will help you if it breaks.
In Drupal 7, many people use the Job scheduler module instead.
#3. Understand your caching
Drupal has its own built-in cache, and Views does too.
However, many hosts will also cache on their own, using Cloudflare, e-Accelerator, or similar tools. Drupal-specific hosts may use a Drupal-specific solution. Some caches affect logged-in traffic only like Memcache, and some affect anonymous (public) traffic like Varnish. In all cases, find out what caching if any they use, and how to make sure your site is compatible with it, and how to turn it off if necessary.
It is worth noting that Drupal 8 strongly recommends Opcache during installation for better storage of cached data which should mean faster access when people try to go to your site. They have been working on this for a long time. This tutorial has more details on caching in Drupal 8.
#4. Check the .htaccess and php.ini files
Many Drupal health problems can be traced to two files.
- .htaccess controls whether your site's URLs work, especially if the Clean URLs feature is turned on.
- php.ini controls how much memory that Drupal can use.
Find the location of these two files and check them carefully.
Hack attempts may sometimes affect the .htaccess file without affecting the rest of the site. Your site should be scanned often. Some hosts offer that as a free service, and some you have to pay for. Companies in that space include Sitelock and Securi.
It is important to recognize that a high-quality hosting company, or a good server admin, is worth their weight in gold. Whether you are trying to solve a problem with e-mail and Drupal and you need to know what is allowed or what can be flexed, or whether there’s something strange with the .htaccess file to prevent logins, they are there to help you. We have some recommendations for Drupal hosting.