Thursday, March 28, 2024

Drupal for the Web Developer: Configuring Your Drupal Website

In the first installment of this series, we learned some of the reasons why Drupal has become a favorite Content Management System (CMS) for discerning web developers, and how to get started quickly with a Drupal system. Now we’ll learn how to tweak the configuration options for best results, focusing as usual on the practical aspects and settings before the esoteric ones.


To get to the main Drupal configuration menu we’ll be working from, you should visit http://YourSiteURL.com/admin/settings/ in your favorite web browser, or http://127.0.0.1/admin/settings/ if you’re working on your own local computer. That will get you to a menu that looks like this:




Let’s review and verify a number of important basic settings. Here’s the drill: simply click on each title to visit the submenu, adjust settings as necessary, then select “Save Configuration” each time before hitting the back button to return to the Site Configuration menu. While in most cases the default is already set to the best choice, a few minutes spent understanding and checking the settings can save you a lot of trouble later on.


Clean URLs: you want these enabled, unless you really like seeing query strings like “?q=” in your URLs.


Date and Time: this should have been automatically set for your region/locale, but you should verify that everything looks the way you want it to. I recommend enabling user-configurable time zones here.


Error Reporting: by the title, you wouldn’t necessarily know this is the place to specify the URL of your custom 404 page, but it is (if you don’t have or set one, it creates a rather plain default). It also lets you set error reporting to the log alone, which is generally what you want on a website. Allowing users to view things like PHP and MySQL errors not only looks ugly on the screen, but is also a potential security problem; however this is the Drupal default.


File System: for most situations, you will want to leave this to the default, which is the “Public” download method with the default file paths and locations. However, this is an important setting that you wouldn’t want to have to change later, so it deserves a bit of explanation.




The main question here for you as the site developer and manager is whether you intend to have a “normal” informational site (blog, showcase, free photo gallery) or one that is more restricted for some reason. Those reasons could include a site where you’re selling access to particular files or online media, one where people are paying for membership (or have different levels of access), or one where e-commerce is being done.


In any of the latter cases, or one like it, you would want to pick the “Private” download method instead, so that access to files would be protected by restrictions you set in Drupal, or other software running on top of Drupal, such as e-commerce or membership modules. You also have to select the file system path carefully; the default path (shown above as sites/default/files) lies under the home directory and thus is potentially accessible from the web. In order to ensure that the path is inaccessible from the web, you should create and use an absolute path (starting with the root of a disk) that is outside of the web server’s purview, such as /var/drupalfiles (for Linux/Unix) or D:specialfilearea (for Windows). You’ll also have to use your operating system’s permission system to make sure that Drupal can write to that directory and create files there as well.


Image Toolkit: you probably want to leave the JPEG quality set at the default of 75% unless you’re running a photo-oriented site, in which case 90% might be more appropriate.


Input Formats: the default settings filter user input so that people cannot insert malicious HTML or Javascript. It’s recommended to leave the settings as they are, unless you believe you know more than the authors even after reading the detailed description of the filters.


Logging and Alerts: unless you’re running into problems which need debugging, it’s recommended to leave this at the default setting of 1000 lines.


Performance: this section has the potential to be the most confusing due to its many settings, but it’s actually not as bad as it seems. Think of your site as being in one of the following modes:


  • Development – You’re starting up the site (as you presumably are now); experimenting with different modules, code, or themes; adding or changing relatively large amounts of content at a time (rather than simply adding a blog post once or twice a day).

  • Online – All the design and code decisions have essentially been completed, content is being added or updated, and the site is being accessed by visitors on a regular basis.

  • Hammered – Your site is suddenly very successful because of exposure on Twitter or Slashdot or internet.com or The New York Times and you’re getting far more traffic than you’re used to and the site is rapidly coming to a halt.

Here are the recommended settings for these modes:


Development: All caching and compression disabled. This allows you to see your changes as they happen, as transparently as possible.


Online: Page caching set to normal, minimum cache lifetime 1 minute, page compression enabled, block caching enabled, optimizations enabled.


Hammered: Page caching set to aggressive (temporarily), minimum cache lifetime 5 to 15 minutes (depending on how often your content is changed), page compression enabled, block caching enabled, optimizations enabled.


The minimum cache lifetime settings may not work for you if you run a system where users add comments to pages, as the caching may cause them to repost their comments if they don’t see them visible instantly, so you should experiment with this in advance.


Site Information: Here’s your chance to customize your site’s name as well as other important global information, such as the page footer. Much of this information can help you in Search Engine Optimization, so write it wisely, and then you’re done with configuring your site!

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured