WordPress is a powerful and most used Content Management System.

Install Nginx HTTP Server

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

Install MariaDB Database Server

sudo apt-get install mariadb-server mariadb-client
sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service 
sudo mysql_secure_installation
sudo systemctl restart mysql.service

How to install PHP 7.3 and related Modules

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
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

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

Create WordPress Database

sudo mysql -u root -p
CREATE USER ‘dbuser’@’localhost’ IDENTIFIED BY ‘userpassword’;
GRANT ALL ON myfirstdb. * TO ‘dbuser’@’localhost’ IDENTIFIED BY ‘userpassword’ WITH GRANT OPTION;


Download WordPress Latest version

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

How to configure Nginx HTTP Server

sudo mv wordpress /var/ww/html/wordpress
sudo chown -R www-data:www-data /var/www/html/wordpress/
sudo chmod -R 755 /var/www/html/wordpress/
sudo nano /etc/nginx/sites-avaialable/wordpress
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 snippest/fastcgi-php.conf;
fastcgi_pass                               unix:/var/run/php/php7.3-fpm.sock;
fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;
sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service

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.