Last updated

Running ExpressionEngine on Media Temple's (dv) Part 1

In a series of articles I'm going to look at running ExpressionEngine on Media Temple's (dv) Base Server and optimising both ExpressionEngine and the server for optimum performance.

Estimated reading time: 3 minutes

Table of contents

Like many web developers I use Plesk on Media Temple’s (dv) Base server. Owing to growing popularity of this blog the server is straining a little. I’ve followed the excellent articles over at David Seah’s site and also the performance optimsation tips on the Media Temple site with good results. But I was still getting memory issues. Whilst the tips are specific to a Media Temple (dv) 3 server they should be good for most linux distros. I must stress I take no responsibility for using this article. Use at your own risk. Everyone is here to learn so if you feel you can add something please do so by leaving a comment.

Optimising ExpressionEngine

In Part 1 we’re going to look at ExpressionEngine and making sure your site is set up to be lean, mean and fast. Out of the box EE does a good job of managing performance. The ExpressionEngine documentation explains the caching options available to you.

Sending it to the browser

One area where EE is a little weak (probably so it is easy to install and use on many different platforms) is in the information it sends to the browser. If you are on a Apache server on Linux and AllowOverride is on you’ll be able to speed up things further using an .htaccess file or better still modifying the Apache configuration.

Here’s an the default file I use for .htaccess

FileETag none  # Turn off ETag 

# Set Language and Character Set
AddDefaultCharset utf-8
AddLanguage en-gb .en

# Ensure GZIP Compression is on
php_value output_handler ob_gzhandler

# Cache images and set default on everything else
ExpiresActive on 
ExpiresDefault A259200
ExpiresByType image/gif A1209600 
ExpiresByType image/png A1209600 
ExpiresByType image/jpeg A1209600 
ExpiresByType image/gif A1209600

# Set css and js so they can be gzipped
<IfModule mod_mime.c>
AddType application/x-httpd-php .css
AddType application/x-httpd-php .js

# Turn off errors
php_value display_errors off

# Config settings for ExpressionEngine
AcceptPathInfo On
Options +FollowSymLinks

Let’s go through this a little. Firstly we turn off ETags. You can find out about why ETags should be off at the Yahoo Performance site. Secondly I set the default character set and language. Then we make sure GZIP compression is on. Now the important bit. ExpressionEngine is poor at sending Expiry Headers (I’m sure there is a good reason) so often the browser will reload things it could easily cache. These rules set a short default expiry and a longer one for images. Next we want CSS and Javascript to be GZipped. To keep Firefox happy you need to add these lines to the top of your CSS files.

<?php header("Content-type: text/css"); ?>

Finally I want to make absolutely sure PHP errors are not shown and I turn on a couple of settings for EE. If you get an internal server error it is likely your host does not allow you to override certain settings. Get in touch with you host and ask. These work ok on (mt)(dv)3.

In part two I’ll be looking at optimising the hardware side of things on the (dv) 3.

Have an update or suggestion for this article? You can edit it here and send me a pull request.


Recent Posts