Optimize WordPress performances on OVH shared hosting

 

Acceleration as derivative of velocity along trajectory

With no added cost, why not speed up?

With these simple steps, you can significantly improve the performances of your OVH hosted WordPress.

I recommend that you benchmark your site performance before performing any changes to be able to measure the improvement.

Step1: Switch to PHP-FPM

As described in the OVH documentation, it is now possible to request your site to be handled by PHP-FPM granting better performance than the default handler.

To do so, create .ovhconfig file at the root of your site. eg.  /www/.ovhconfig

 /www/.ovhconfig

app.engine=php
app.engine.version=5.5
http.firewall=none
environment=production

Step2: Enable compression and browser caching

This is done in the .htaccess file at the root of your site. eg. /www/.htaccess

Note that I keep the SetEnv instructions as a fallback.
See more about the configuration of the .ovhconf in the official documentation (French)

/www/.htaccess

SetEnv SG_DEFAULT_PHP_VERSION 5

SetEnv PHP_VER 5_5

RewriteEngine on
## BEGIN WordPress ##

  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]

## END WordPress ##

## EXPIRES CACHING ##

  ExpiresActive On
  # Format: A where n is a number of seconds. Expires cache n seconds after access
  ExpiresByType application/javascript A2629740
  ExpiresByType application/x-javascript A2629740
  ExpiresByType text/javascript A604800
  ExpiresByType text/css A604800
  ExpiresByType image/gif A2629740
  ExpiresByType image/x-icon A2629740
  ExpiresByType image/icon A2629740
  ExpiresByType image/jpg A2629740
  ExpiresByType image/jpeg A2629740
  ExpiresByType image/png A2629740


## ENABLE APACHE SERVED FILES COMPRESSION ##
## http://developer.yahoo.com/performance/rules.html#gzip

  # Insert filter on all content
  SetOutputFilter DEFLATE
  # Insert filter on selected content types only
  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
  # Netscape 4.x has some problems...
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  # Netscape 4.06-4.08 have some more problems
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  # MSIE masquerades as Netscape, but it is fine
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  # Don't compress images
  SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
  # Make sure proxies don't deliver the wrong content
  Header append Vary User-Agent env=!dont-vary

FileETag MTime Size

1 Comment

  1. Pablo Lopez Fernandez May 7, 2016 6:14 pm  Reply

    Hi Martin,

    nice post!

    I\’m going to try this, but first I\’d like to know if this is something that can improve your speed even more than use W3Cache and similar plugins.

    Also a question, do you follow this steps and also use plugins to improve your speed?

    Thank you for your time and knowledge! 🙂

Leave a Reply