How to Install WordPress on Ubuntu 20.04 VPS with Virtualmin & Nginx

Configure Unmanaged VPS with Virtualmin and Nginx, then install WordPress with Pretty Links

WordPress is currently the most popular CMS in the world. Millions of webmasters use it to create their websites. It is newbie friendly and has a very simple installation process. But things get little complicated on unmanaged VPS. If you’re planning to use an unmanaged VPS, you can use instructions on this page to install WordPress on Ubuntu 20.04 VPS with Virtualmin & Nginx.

The WordPress setup this tutorial produce is focused on performance. We’ll be building a high-performance web server with Virtualmin v7.1 GPL, Nginx v1.22, PHP v8.0 and MySQL v8. It’s a well-known fact that WordPress is faster on nginx. And Virtualmin gives a nice GUI to manage your VPS.

Prerequisites

This tutorial requires you to have a Ubuntu 20.04 VPS. Which you can get from one of my recommended VPS providers. And then complete following steps,

Completing those steps build the environment for WordPress on your VPS. You may ignore optional steps. But I recommend completing them prior to installing WordPress.

Need WordPress Installed?

Would you rather have an experienced Linux Server Administrator configure your VPS and install WordPress for you? Get it done the right way!

Monthly VPS Management

Get a professional Linux Server Administrator maintain your VPS on daily basis for a small monthly fee. Our service include,

Download WordPress

Assuming you have everything above in place, you can now install WordPress on your domain or subdomain. But to do so, you need to login to your VPS with domain’s admin user. Not the root user. Once logged in, run following command to change the current directory to domain’s web directory,

cd $HOME/public_html

Following commands will download and extract WordPress package,

wget http://wordpress.org/latest.tar.gz
tar --strip-components=1 -xvf latest.tar.gz
rm latest.tar.gz

WordPress should be ready to install now. But there’s one more thing we should do before installing it.

Add Nginx Rewrite Rules for WordPress

WordPress needs custom nginx rewrite rules for pretty links to work. You should add these rules to nginx configuration file for the domain. This needs to be done with the root user account of your VPS. So, switch root account and open Nginx virtual host file for the domain,
nano /etc/nginx/sites-available/example.com.conf
Replace example.com with your domain name. Look for following line within the file (Ctrl+W).
fastcgi_param HTTPS $https;
Add this rule BELOW it,
location / {
                try_files $uri $uri/ /index.php?$args; 
        }
File should look like this, nginx-config Hit Ctrl+X to save changes and close the file. Finally restart Nginx,
service nginx restart
Your server is now fully configured for WordPress. You now run the WordPress install to complete the installation.

Install WordPress on Ubuntu 20.04

This is where you actually install WordPress with Virtualmin & Nginx. Open your domain name in browser. You’ll be asked to select the language for your WordPress installation. Select it and continue till you see this page. wp-admin-setup-config-php Database name and username will be same as your admin username in most cases. You can find MySQL password in Virtualmin. Refer to Obtaining MySQL credentials for a domain from Virtualmin. Copy password to the WordPress installer and click submit. You don’t need to change anything else on that page. Hard part of the installation is now over. Continue the final steps of the installer and complete the installation. That concludes the instructions to install WordPress on Ubuntu 20.04 VPS with Virtualmin and Nginx. Create a topic on sysadmin forum if you have issues with the installation.

Tharindu

Hey!! I'm Tharindu. I'm from Sri Lanka. I'm a part time freelancer and this is my blog where I write about everything I think might be useful to readers. If you read a tutorial here and want to hire me, contact me here.

Related Articles

9 Comments

  1. Hey,
    thanks for all these useful guides!

    One point I’m missing, where can I find the key to connect ssh with the domain’s admin user? I only have the one created for the root.

  2. thanks for the guideline, I have followed all the step till install WordPress. when opening my domain in my browser Under Construction page opens, How I can access the control panel to manage. I normally enter (mydomain.com/wp-admin) is that correct

  3. hi there
    when run this command “cd $HOME/public_html” its return -bash: cd: /home/ubuntu/public_html: No such file or directory

    that could be the reason for not able to install the WordPress

  4. Hwllo, is it possible to make some script that
    nano /etc/nginx/sites-available/example.com.conf
    Automatacly add
    ocation / {
    try_files $uri $uri/ /index.php?$args;
    }

    So don’t need to change these settings after every wordpress install?
    Best Regards

Leave a Reply

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

Back to top button