Review & FAQ – Set Up a VPS to host WordPress

A few unplanned and unannounced service outages with my VPS provider made me realize that it was time to jump ship, and take my business elsewhere.

SiteGround introduction

Several friends of mine are using SiteGround for their VPS needs, and highly recommended their product. SiteGround offers VPS solutions from servers with 512MB of RAM, all the way up to servers with 96GB of RAM. All of their servers use extremely fast SSD drives.

I opted to set up a 1GB RAM VPS, running Ubuntu Server 12.04.3 LTS. The VPS “droplet” only took a minute to create, and I was very quickly on my way to get the new server up and running. Thankfully, I saved the web references that I used last time to set up my old VPS.

LAMP and phpMyAdmin installation

Webrich Software used to have an excellent article titled “LAMP Server and phpMyAdmin installation” which detailed how to set up LAMP and phpMyAdmin. The article has since been removed, however I was able to find a cached copy and it is now located here for reference. I followed these directions to the letter. The post makes reference to using gedit as text editor; obviously use whichever text editor you feel most comfortable using.

You will need mod_rewrite enabled on your Apache server if you want fancy SEO and user friendly page names with your WordPress installation. The mod_rewrite function is not usually enabled when Apache server is first installed. Fortunately, the very clueful staff at DigitalOcean has already written this excellent article “How To Set Up Mod_Rewrite” detailing how to enable mod_rewrite.

WordPress system files

Next, you will need to install the WordPress files on your system for each site installation. Set up two separate directories for the files; one directory for the system files, and another directory for the log files. For example, WordPress files could be installed in:

I must admit that I have installed WordPress many times, however only recently have learned how to set proper file permissions and ownership so that WordPress can function properly. My previous installations always had issues with the system being able to create the proper file structure in /wp-content. This excellent article “Setting Proper WordPress Unix Permissions” spells it all out to get the file structure working properly.

Basically, you want your user account to own the WordPress installation directory, and all files in it as yourusername:yourusername with permissions 664, with just a few exceptions. The /wp-content directory and its contents needs to be owned by the web server account, which is either apache or www-data, with group ownership of either ‘yourusername’ or a special group created for admins.

The /wp-content directory and its entire contents will need permissions set to 775 to be able to add and remove files via your FTP login. You can set these permissions from the command line while in the docroot of your site by typing: sudo chmod -R 775 wp-content/

Ownership of .htaccess, .htpasswd (optional), and wp-config.php to should be set to root:root with permissions 664 to prevent anything bad happening to these important files!

Securing WordPress and phpMyAdmin from hackers

Next, take a look at another excellent DigitalOcean article about “How To Install and Secure phpMyAdmin on Ubuntu 12.04” to keep your phpMyAdmin installation safe from unauthorized access. Your phpMyAdmin login page should be protected with .htaccess and .htpasswd files to prevent brute force attacks on the root login password.