While the initial setup of a WordPress VPS can be more approachable through a shared web host, it often leads to issues down the line. Most notably, you can't guarantee performance, control security, make advanced adjustments, or scale it to without significant cost.

VPS hosting addresses these issues, but it can also be intimidating. Less technically inclined users envision a world where they have to run hundreds of commands or work day and night to keep their blog secure.

This guide is designed to show how easy it is to set up a WordPress site with a modern VPS provider, while providing the knowledge and tools for more advanced configuration if needed.

What is WordPress?

Though many know WordPress for its use in blogs, its functionality goes much further than that. WordPress is a fully-fledged Content Management System (CMS), which allows its users to create websites of all types and quickly update them with fresh content.

The power of WordPress comes from its balance of simplicity and functionality. While it's not as easy to use as say, Squarespace, it doesn't require any coding knowledge to utilize.

Despite this, the CMS platform is extremely customizable. At the time of writing, there are over 11,000 themes on ThemeForest alone and 54,000 free plugins. Some of those plugins enable simple drag and drop content creation for ease of use.

At its core, WordPress uses PHP, HTML, and CSS to display its content in a way that's visually appealing to the end user. It also makes use of Nginx or Apache for web serving, and MySQL or MariaDB to maintain a database of posts, URLs, users, comments, and more.

Pay for and set up your WordPress site (the easy way)

Most VPS providers these days provide a code-free way to get your WordPress blog up and running. First, though, you need to sign up for their service. For some providers, this can be a lengthy process, but at BitLaunch we only require an email address to get you on your way.

You can talk to support to get free credit or top up with cryptocurrency immediately via our new payment system. When creating a WordPress VPS server, it's first important to select the specs that are suited to your needs.

While a 1 GB/1 CPU server will work okay for a small, low traffic blog, it may not be enough if you plan to host a lot of images or have a significant readership.

BitLaunch, Digital Ocean, and Vultr servers all provide a one-click app for WordPress, automatically installing all of its dependencies and creating databases for you. Some hosts, however, require configuration changes before you can access your WordPress installation.

You can read our full guide for more information.

Install LEMP stack

As mentioned earlier, WordPress utilizes a variety of technologies, but the relevant ones in our case are Linux, Nginx, MySQL, and PHP, known together as LEMP. If you're looking to install WordPress manually, getting LEMP set up on your server is the first step.

In short, to install LEMP you need to:

  • Install Linux
  • Install Nginx: sudo apt install nginx
  • Install MySQL: sudo apt install mysql-server
    • Set up MySQL security: sudo mysql_secure_installation
  • Install PHP: sudo apt install php-fpm php-mysql php-gd
    • Restart httpd: sudo service httpd restart
    • Edit your php config to allow php script processing

If you're on CentOS or another variant of Linux, simply replace apt with your relevant package manager.

Need more help? Here's how to install LEMP stack on Ubuntu 20.04

Manually install WordPress

Once you have LEMP installed, it's a relatively simple process to install WordPress on Linux. First, it's necessary to create a database using MySQL.

mysql -u -root -p
CREATE USER wpadmin@localhost IDENTIFIED BY "secure password";
GRANT ALL PRIVILEGES ON wordpress.* TO wpadmin@localhost;

You can then download WordPress from the official site, extract it to /var/www/html/, and run sudo shown -R apache:apache /var/www/html/*.

With that, you can move onto WordPress configuration, which can be achieved by entering your.server.IP/wordpress in the browser of your local PC. See our full guide below for more information on the install and configuration process.

Stuck with configuration or want to learn more? Read our full WordPress installation guide.

Fix "error establishing database connection" issues

Unfortunately, while WordPress works just fine for most people, it does have a tendency to throw up the non-specific "error establishing database connection" every once in a while. This is particularly prevalent if you've just installed WordPress and made a mistake during configuration.

Typically, this error is caused by one of three things:

  • The database errors in your wp-config file don't match the database on your server
  • Your server has run out of memory
  • Your database tables have been damaged by a plugin, update, or other change

If you're just installing WordPress and getting this error, a simple fix may be to verify that the information you entered in the "Username" and "Password" fields match the credentials you created with MySQL earlier.

Didn't fix your problem? Read our full error establishing database guide.

Back up your WordPress Database

If you do run into database issues, it's useful to know how to back up and restore a MySQL or MariaDB database with mysql dump.

So long as the database is running and accessible, you can create a copy of it at any time. Preferably, this should be copied to a different server or cloud storage solution for resilience.

The basic command structure to back up a MySQL database looks like this:

mysqldump -u username -p databasename > filename-$(date + %F).sql

You can use variations of this to back up all WordPress databases on your VPS or a single table if you wish. Some additional configuration can also automate the backup process so you don't need to give it a second thought.

Learn how to perform automatic backups in our dedicated mysqldump guide.

Secure your WordPress installation

Though it's tempting to jump straight into building your website, we strongly recommend that you take some time to improve your WordPress security first. WordPress sites are a favorite target for automated attackers due to their tendency to house the login page at the same URL and use insecure plugins.

Generally, every WordPress admin can do the following to make their site more secure with minimal effort:

  • Protect against brute force attacks with a plugin to limit login attempts
  • Check every plugin you install against the plugin vulnerability database
  • Enable HTTP authentication for your wp-admin page
  • Use SFTP for file transfers
  • Secure the wp-includes folder
  • Turn off file editing

The following changes may not stop a determined attacker, but they'll certainly make their job much harder while cutting out automated attacks.

Need help implementing these changes? Read our full guide.

Secure your VPS server

Your WordPress installation is just one way an attacker can compromise your site. If they gain access to the underlying VPS server, they essentially have the keys to your kingdom. To prevent this, you should be proactive with security by following these tips:

  • Keep your VPS updated with security and software patches
  • Don't log in as root
  • Use an SSH key to log in to your server
  • Keep an eye on your network services
  • Configure your firewall correctly
  • Use Fail2ban to limit login attempts

With all of this in mind, you're ready to install themes and customize your WordPress site to your heart's content.

Find out how to implement these security tips in our dedicated VPS security guide.

Ready to get started with WordPress?

Consider joining BitLaunch for access to a high-speed anonymous VPS that avoids the failings of traditional web hosts.