Now a days 40% of entire internet users are using Wordpress as their business or blogging. As Wordpress provides a very easy to access backend for the administrator to manage the website & its content. Even for e-commerce, it is very much easier to integrate with woocommerce and sale products online. Which is why i am writing this blog to help those who wants to configure wordpress on their own ubuntu server.
Why dedicated server not shared hosting?
There are many ways to make one wordpress site live. Out of which shared hosting is the easiest way to do so. However there are certain limitation to it. Such as,
- Memory limitation depending on the subscription bought by the provider
- Slow Bandwidth
- Not good for long term
- Expensive once you get large number of users
To avoid all these problems and limitations, i am sharing the best way to go live with your domain.
I don’t know what to do. From where should i start?
Do not worry as i will be sharing all the steps, so that one Novice can setup one Wordpress site within 30 minutes in any ubuntu server.
STEP – 1 (Getting a domain name)
Before starting the setup or configuration, you need to buy a domain name first. you can buy domain name from godaddy.com/namecheap.com/domain.com/idswebhosting.com etc.
Choose a domain name and buy the domain name from there. But make sure not to buy any hosting package from them otherwise you will be overcharged. Once the domain name has been bought, we are done with step – 1 and can move forward to buy one ubuntu server from AWS / Digital ocean.
STEP – 2 (Getting an Ubuntu Server)
You are doing great! Now that you have bought the domain name, we will go forward to buy one ubuntu server. There are multiple ways to buy one ubuntu server however i will always prefer to go with cloud servers as they are fast and easy to manage. My suggested ones are
- AWS – 1 year free tier server for new users (only micro servers)
- Digital Ocean – 1 month free trial
- Azure – $200 Free for first users
- GCP (Google Cloud) – $300 Free for first users
- IBM – $200 for new users
I always use digital ocean as its very much each to manage and the resize functionality is very much easy to use. However please make sure to not use any new applications in terms of AWS and Azure as they might cost you a lot which you may have to pay next month. Such as Auto scale, Lambda etc.
Choose any of the cloud servers as per your convenience & buy one ubuntu server (16.04/18.04/20.04 LTS). All Ubuntu servers are Debian based, so it will not have any problem in installation. You can choose any version of Ubuntu.
Once you have bought the server, you will be assigned with an IP address & DNS for your server. With that you will get one username & password/.pem file to log-into the server.
For Windows users, you need to download PuttY . And use your ip address, username and password to login. If you have the .pem file, you need to generate a ppk file from pem file using puttygen which will auto installed by installing putty. You can follow the below videos for your reference.
For Linux/Mac users, you can use your terminal to log into the server using the below code.
chmod 400 <pem file>
ssh <username>@<ipaddress> #For Username & Password
ssh -i <pemfile> <username>@<ipaddress> #For PEM File
STEP – 3 (Installing Prerequisite before setting up)
Before starting anything, we need to install the default prerequisite to make the server ready for the deployment. So, Run the below commands to install all the required applications.
We will now install Nginx, PHP7.3-FPM & MariaDB
sudo apt-get install nginx
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update
sudo apt install php7.3-fpm php7.3-common php7.3-zip php7.3-curl php7.3-xml php7.3-xmlrpc php7.3-json php7.3-mysql php7.3-pdo php7.3-gd php7.3-imagick php7.3-ldap php7.3-imap php7.3-mbstring php7.3-intl php7.3-cli php7.3-recode php7.3-tidy php7.3-bcmath php7.3-opcache
apt-get install mariadb-server
systemctl enable mariadb.service
mysql_secure_installation
Step – 4 (Configuring Database)
Now that all the required applications has been installed, we will move forward to configure the database and create a database for our wordpress site.
To login and set a password for root in mysql environment, run the below command, (sudo mysql
– for admin)
$ mysql -u root -p
MariaDB [(none)]> use mysql;
MariaDB [mysql]> update user SET PASSWORD=PASSWORD("Passw0rd!") WHERE USER='root';
Now create a database for your wordpress website using the below command,
$ mysql -u root -p
Enter password:
MariaDB [mysql]> CREATE DATABASE wordpress_db;
Query OK, 1 row affected (0.00 sec)
MariaDB [mysql]> GRANT ALL ON wordpress_db.* TO 'wpuser'@'localhost' IDENTIFIED BY 'Passw0rd!' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> exit
Now we are all set from DATABASE side. Lets move to set NGINX.
Step – 5 (Configuring NGINX)
Before configuring NGINX download the wordpress and save it in an external accessible directory. (/var/www/html)
cd /var/www/html
mkdir my_wordpress
wget http://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
cd ~/wordpress
Now you need to go to the nginx settings directory (/etc/nginx/sites-available)
cd /etc/nginx/sites-available
vim my_wordpress.com
#Paste the below code to your file and save it by :wq
server {
root /var/www/nitikeshp.com;
index index.php index.html index.htm index.nginx-debian.html;
server_name domain.com www.domain.com;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .php$ {
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
listen [::]:80;
listen 80;
}
now test your nginx file using
nginx -t
It should give you the below output.

Once this is done, we will mov forward to install SSL certificate for https connection.
Step – 6 (Installing SSL using Certbot & Let’s Encrypt)
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com
Now we are done for the Setting up and configuration. The last step will be to connect your domain to the Server.
Step -7 (Connecting DNS from Domain Name to Ubuntu Server)
Log into your Domain provider and got o your DNS settings. There add your Server ipaddress in A-Record as mentioned in the below screenshot.

Normally, it takes 15-20 mins to change your DNS. Once the DNS has been pointed, you can go to your domain name and install wordpress in the UI view and use wordpress.
I hope it helped you while installing and configuring wordpress in the server. If you like this, please follow and share with your friends for more visibility.