Drupal

Drupal is an open source content management system which can be used to build blogs, portals, and other web sites. WebFaction provides a control panel installer for Drupal.

See also

Drupal is a PHP-based application. Please see PHP and Static Files, CGI Scripts, and PHP Pages for additional documentation.

Backing Up Drupal

Backing up your Drupal application is an important routine task. We also recommend that you back up your application before making major changes, such as upgrading Drupal.

To back up a Drupal application:

  1. Open an SSH session to your account.

  2. Switch to your Drupal application directory. Enter cd $HOME/webapps/drupal_app, where drupal_app is the name of your Drupal application, and press Enter.

  3. Make drush executable. Enter chmod u+x ./bin/drush and press Enter.

    Note

    You can skip this step if you’ve already done so for this Drupal installation.

  4. Set the PHP version for Drush. Enter export DRUSH_PHP=$(which php56) and press Enter.

  5. Back up Drupal. Enter ./bin/drush archive-backup default and press Enter. An archive containing a backup of your Drupal site is created in ~/drush-backups.

    Optionally, you can specify a destination path for your backup by adding --destination path to the command. For example, to back up to ~/latest.tar.gz, enter ./bin/drush archive-backup default --destination=-$HOME/latest.tar.gz and press Enter.

The Drupal backup file has been created.

Updating Drupal

Updating Drupal can protect a Drupal site from security vulnerabilities and fix bugs. To update Drupal to the latest version using Drush:

  1. Open an SSH session to your account.

  2. Back up your Drupal site.

  3. Refresh Drush’s list of known Drupal versions. Enter ./bin/drush rf and press Enter.

  4. Upgrade Drupal core. Enter ./bin/drush up drupal and press Enter.

    Alternatively, to install only security updates, run ./bin/drush up drupal --security-only

    You can also choose to upgrade to a specific Drupal core version by appending a version number. For example, to upgrade to Drupal 8.0.1, run ./bin/drush up drupal-8.0.1.

The Drupal site is updated.

Configuring Clean URLs

Drupal’s Clean URLs feature replaces URLs like http://www.example.com/?q=node/123 with URLs like http://www.example.com/node/123.

Note

Drupal 8 applications have clean URLs enabled by default.

See also

Drupal Clean URLs documentation

To configure Drupal to use Clean URLs:

  1. Activate the RewriteBase Apache directive.
    1. Open an SSH session to your account.
    2. Open ~/webapps/application/.htaccess in a text editor, where application is the name of the Drupal application.
    3. Configure the RewriteBase directive.
      • If the Drupal application is mounted on a non-root URL path (for example, http://domain/drupal), replace # RewriteBase / with RewriteBase /path, where path is the non-root URL path on which the Drupal application is mounted.
      • If the Drupal application is mounted on the root URL path, uncomment # RewriteBase /. Replace # RewriteBase / with RewriteBase /.
    4. Save and close the file.
  2. Configure Drupal to use Clean URLs.
    1. Log in to Drupal.
    2. Click Administer. The administration menu appears.
    3. Click Modules. The Modules configuration page appears.
    4. In the list of modules, click to select Path.
    5. Click the Save configuration button. The page reloads with a confirmation message.
    6. Click Site configuration. The Site configuration page appears.
    7. Click Clean URLs. The Clean URLs form appears.
    8. Click to select Enabled.
    9. Click the Save configuration button. The page reloads with a confirmation message.

The Drupal application will now use clean URLs.

Serving Uploads Faster

To improve the performance of your Drupal site, create a symbolic link application to serve uploaded files directly.

See also

If you want to use an external CDN service, see the CDN module.

To create and use a symlink application:

  1. Log in to the WebFaction control panel.

  2. Click Domains / websites ‣ Websites. The list of websites appears.

  3. Click on the name of the site that includes your Drupal application. The site’s details appear.

  4. Click Add an application ‣ Create a new application. The Create a new web app form appears.

  5. In the name field, enter a name for the application.

  6. In the App category menu, click to select Symbolic link.

  7. In the Extra info field, enter /home/username/webapps/app/sites/default/files/, where username is your username and app is the name of the Drupal application.

  8. In the URL field, enter the URL path to the uploaded files. Typically, the URL is the Drupal application’s URL path and sites/default/files.

    For example, if the Drupal application’s URL path is /blog, enter blog/sites/default/files.

    If the Drupal application is at the root of the domain, enter sites/default/files.

  9. Click the Save button. The application is installed and added to the website’s list of applications.

  10. Click the Save button.

Future requests for Drupal uploads are served by the server’s front-end process, skipping the unneeded PHP interpreter.

Speeding Up Drupal with Caching

Some Drupal sites may see improved page load times by enabling caching.

To enable Drupal caching:

  1. Log in to your Drupal site.
  2. In the tool bar, click Configuration. The Configuration menu appears.
  3. In the Development section, click Performance. A settings form appears.
  4. In the Page cache maximum age menu, click to select a duration. Try experimenting with different values to find the best performance. 1 hour is a good starting value.
  5. Click the Save configuration button.

Future requests for cached resources will require less response time.

Sending Email from Drupal

To configure Drupal to be able to send email messages:

  1. Log in to your Drupal site.
  2. In the tool bar, click Configuration. The Configuration menu appears.
  3. In the System section, click Site information. The Site information page appears.
  4. In the Email address field, enter the outgoing email address for notification, password recovery, and other Drupal email.
  5. Click the Save configuration button. A The configuration options have been saved notification appears at the top of the page.

Future outgoing messages will be sent from the designated address.

Troubleshooting

Strange Characters on 404 Pages