This is just a small writeup on setting up WordPress on a Nginx server running Ubuntu 16.04 LTS. The prerequisite is also that is has PHP and MySql. Basically this post is a summary of my other posts on WP and Nginx.

So with the basic stuff out of the way let us jump right in to the nitty-gritty of the setup.

I’ll assume that you set up the vhost manually and edit the file with a sudo user in the terminal of the server. I’ll have a some notes at the end about using ISPConfig.

Before you start creating a new vhost, check that your nginx.conf file includes the fastcgi parameters file included. Check the conf file for a line like this:

include /etc/nginx/fastcgi_params;

Now open your vhosts conf file. At he end, before the last },  you can add the following lines.

try_files $uri $uri/ /index.php?$args;
location = /xmlrpc.php {
if ($http_user_agent !~* "(poster|wordpress|windows live writer|wp-iphone|wp-android|wp-windowsphone)") {
return 403;

The first line is for pretty permalinks in WordPress. The next lines are for denying all access to the XMLRPC file. This file is used for remote accessing your WordPress install by applications like the WordPress app for Android or iOS (and other apps) and the JetPack plugin from Automattic. And those lines make sure that legit access is allowed.

When this is done, you can restart your web server with service nginx restart.

If you are using ISPConfig to manage your server, there is a few things you should do. If you ever update your site with ISPConfig, your vhost file will be overwritten and your changes will be lost. But instead of editing the files directly, you can use the Nginx directive section found on the Options tab of your “Web domain” editing page. Used place all of the text above in that field, and they will survive an update done by ISPConfig.