This is a bit of a technical article for me (I’m no server wizard), so please excuse any misunderstandings/misuse of terminology on my part.

I’ve finally got my VPS hosting working with nginx and WordPress, which, looking at various articles online, can be tricky in a lot of cases. The main reason for doing this of course is speed – a WordPress site using “FPM application served by nginx” makes things noticeably quicker than using “FastCGI application served by Apache”.

A few things to note to begin with. My hosting is Cloud VPS with a great company called who have really good support and helped me to get this sorted. My hosting settings are currently managed using Plesk version: 12.5.30 Update #60 – if you want to attempt this you need to be able to configure your server settings, or ask your host to do this.

So, first things first. Go to Plesk, and under your relevant domain find your “PHP Settings” and “Apache and nginx Settings“:

Go into “PHP settings” and make sure you configure this domain to use the following: i.e. PHP 7 and ‘run PHP as “FPM application served by nginx”‘:

Secondly, go into “Apache & nginx Settings” and scroll down to a ‘Additional configuration directives‘ panel, and put the code (see below*) in:

NB this example does not contain any ‘cache’ directives.

My understanding is that switching to nginx takes control away from the usual .htaccess file in your WordPress directory. this is where ‘rewrites’ are managed (e.g. permalinks) and if you’re using a cache plug-in your .htaccess file will contain extra configuration code for that (sometimes this code is quite extensive), but this may all be ignored, hence the requirement to set up these ‘directives’ in the Plesk panel manually.

The problem is that there are lots of different examples of the code to put here if you search online. And there are lots of ways you can ‘break’ things (e.g. if your WordPress site is in a subdirectory the directives will probably need to be adjusted accordingly). There’s a good but technical document here, which also contains and example for cache directives:  and explains a few things in more detail.

So I simply provide this example as it did work for me (and importantly didn’t break on the /wp-admin/ URL which some examples did). If you want specific permalink/blog URL structures you may need to adjust this base code.

Good luck!


*Copy and paste:

# enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain text/javascript application/javascript application/x-javascript text/xml text/css;
gzip_vary on;
# end gzip configuration

location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
expires max; log_not_found off;

rewrite !.(js|ico|gif|jpg|png|css|pdf|mov|mp3|eot|svg|ttf|woff|otf|txt|swf)$ /index.php break;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;











One Comment

  • added 2020: Stuff changes fast! Some of this information is now out of date, and servers get updated, functionality is added etc.
    For instance – the GZIP stuff is now standard on my VPS server and doesn’t need to be applied in the ‘directives’.
    I’ve also found that the WP-Optimize plugin (which i used to use for database cleans) now has a cache component built in.
    In real world tests this cache component has worked really well on my server and I no longer install separate cache plug-ins as i used to. It handles browser caching, purge timescales, GZIP, manual cache purging (only for Admins as we speak which can be an issue if you have Editor roles in play), and ‘static file headers’.

Leave a Reply

Your email address will not be published. Required fields are marked *