24 C

How to install WordPress on Ubuntu 19.04 with Nginx, MairaDB and PHP 7.3 Support

What is WordPress?

WordPress, a powerful and most used CMS (Content Management System). Most websites run on this popular and useful tool. If you want to manage your PHP based websites or blogs easily, you should highly consider it…

Now, with PHP 7.3 WordPress allow you to create stunning websites and improve your site performance. As WordPress requires a server so we highly recommend to use Nginx HTTP Server. If you want to install WordPress on Ubuntu 19.04 with Nginx HTTP Server, just follow these steps.

So, in this tutorial you will learn:

  • 1) How to install Nginx HTTP Server
  • 2 How to install MariaDB Database Server
  • 3) How to install PHP 7.3 and related Modules
  • 4) Create WordPress Database
  • 5) How to download WordPress Latest version
  • 6) How to configure Nginx HTTP Server
  • 7) How to enable WordPress and rewrite modules
  • 8) How to restart Nginx
  • 9) Configure WordPress

Step 1: Install Nginx Http Server

To start using WordPress, we require a web server. We recommend to use Nginx Http Server due to its proficiency. So, lets install Nginx on Ubuntu by executing the following command.

- Advertisement -

sudo apt install nginx

Note: When prompt choose yes to continue. After it some process will begin and installation will be completed depending on your internet speed.

Now, execute the commands given below to start the services always with the server boots.

sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service

Step 2: Install MariaDB Database Server

Beside a web server, WordPress also requires a database server. So, we recommend you to install mairadb database Server. To install it just type the following command:

sudo apt-get install mariadb-server mariadb-client

Note: When prompt choose yes to continue. After it some process will begin and installation will be completed depending on your internet speed.

After installing, do the same steps as in Step 1  to stop , start and enable the services for the server boots so that it always in up state when we start our system.

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service 

When you’ve done this now it’s time to secure your MariaDB so execute the following command to secure. It will also help  you to stop remote access.

sudo mysql_secure_installation

After running this command, you are asked to answer some questions so give answers according to your requirements:

Enter current password for root(enter for none): Just press Enter

Set root password? [Y/n]: Y

New password: Enter Password

Re-enter new password: Repeat password

Remove anonymous users? [Y/n]: Y

Disallow root login remotely? [Y/n]: Y

Remove test database and access to it? [Y/n]: Y

Reload priviledge tables now? [Y/n]: Y

Restart MariaDB Server

sudo systemctl restart mysql.service

Step 3: Install PHP 7.3 and Related Modules

To install PHP 7.3 for WordPress in Ubuntu just follow these steps:

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:ondrej/php

Press Enter to continueAfter doing so update and upgrade to PHP version you want or latest.

sudo apt update

Execute this command to install PHP 7.3 FPM and related other Modules.

sudo apt install php7.3-fpm php7.3-common php7.3-mbstring php7.3-xmlrpc php7.3-soap php7.3-gd php7.3-xml php7.3-intl php7.3-mysql php7.3-cli php7.3-zip php7.3-curl

Press Enter

After installing PHP 7.3, run the command given to open PHP-FPM default file.

sudo nano /etc/php/7.3/fpm/php.ini

Then do the setting according to your requirements and save the file.

file_uploads = On

allow_url_fopen = On

memory_limit = 256M

upload_max_filesize = 100M

cgi.fix_pathinfo = 0

max_execution_time = 360

date.timezone = America/Chicago

Step 4: Create WordPress Database

After installing all the packages that were required you are now at the step to create a WordPress database. Run the given command to create a database in WordPress.

sudo mysql -u root -p

After this create a database with name “myfirstdb


Now create a user as “dbuser

CREATE USER ‘dbuser’@’localhost’ IDENTIFIED BY ‘userpassword’;

Then give the user all permissions to the database.

GRANT ALL ON myfirstdb. * TO ‘dbuser’@’localhost’ IDENTIFIED BY ‘userpassword’ WITH GRANT OPTION;

Finally, save the changes you have made and exit.



Step 5: Download WordPress Latest Release

Now download the WordPress from their official site.

After the WordPress is downloaded extract the file by following commands to extract into a new WordPress root directory.

cd /tmp && wget https://wordpress.org/latest.tar.gz

tar -zxvf latest.tar.gz

sudo mv wordpress /var/www/html/wordpress

After it run the give command to set to the correct Permissions for WordPress to function.

sudo chown -R www-data:www-data /var/www/html/wordpress/

sudo chmod -R 755 /var/www/html/wordpress/

Step 6: Configure Nginx HTTP Serve

Finally, configure Apache2 site config file for WordPress. It will control how users access content . Run the given command to create a configuration file called “wordpress”

sudo nano /etc/nginx/sites-available/wordpress

Then just copy paste the following give code into the file and save changes.

Note: Change the bold text with your own location and domain.

server {

listen 80;

listen [::] : 80;

root /var/www/html/wordpress;

index index.php index.html index.htm;

server_name example.com www.example.com;

client_max_body_size 100M;

location / {

try_files $uri $uri /  /index.php?$args;


location ~ \.php$ {

include snippets/fastcgi-php.conf;

fastcgi_pass                               unix:/var/run/php/php7.3-fpm.sock;

fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;



Save the file and exit.

Step 7: Enable the WordPress and Rewrite Module

As you have configured the VirtualHost above, now enable it by running command below the commands will also disable PHP7.0 to PHP7.3 for Nginx.

sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/

Step 8: Restart Nginx

Now for loading all settings above, restart Nginx by executing following command:

sudo systemctl restart nginx.service

Step 9: Configure WordPress

sudo mv /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php

After it execute this command to open the WordPress configuration file.

Sudo nano /var/www/html/wordpress/wp-config.php

Now enter the highlighted text below that you created for your database and save.

// ** MySQL settings – You can get this info from your web host ** //

/** The name of the database for WordPress */

define(‘DB_NAME’, ‘myfirstdb’);

/** MySQL database username */

define(‘DB_USER’, ‘dbuser’);

/** MySQL database password */

define(‘DB_PASSWORD’, ‘sabisaii’);

/** MySQL hostname */

define(‘DB_HOST’, ‘localhost’);

/** Database Charset to use in creating database tables. */

define(‘DB_CHARSET’, ‘utf8’);

/** The Database Collate type. Don’t change this if in doubt. */

define(‘DB_COLLATE’, ”);

Save and Exit.

Now, open your browser and browse to your domain name to launch WordPress Configuration Wizard.

You will see the wizard open.

Enter your new username and password and click on Install button.

WordPress is Successfully Installed!

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


  1. Hi sabi
    thank you very much for this article, but there are some spelling mistakes in your blog, which may make beginners give up halfway.

    1: sudo mv wordpress /var/ww/html/wordpress “ww”->”www”
    2: sudo nano /etc/nginx/sites-avaialable/wordpress “avaialable”->”available”
    3: include snippest/fastcgi-php.conf; “snippest”->”snippets”


Please enter your comment!
Please enter your name here

Latest article