Adding a non-root user for yourself

adduser jay

usermod -aG sudo jay

exit

Now that you have a user set up for yourself, be sure to log out and log in as that user before continuing.


Updating the hostname

Edit the following files in order to add your hostname or domain name to your instance.


sudo nano /etc/hostname

sudo nano /etc/hosts

Install updates

Before continuing, we should make sure we have everything up to date to benefit from all current security patches for Ubuntu.


sudo apt update

sudo apt dist-upgrade

Reboot the instance

sudo reboot

Install Apache

sudo apt install apache2

systemctl status apache2

Set up MariaDB

sudo apt install mariadb-server

sudo mariadb

CREATE DATABASE wordpress_db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

SHOW DATABASES;

GRANT ALL PRIVILEGES ON wordpress_db.* TO wordpress_user@localhost IDENTIFIED BY 'secret_password';

FLUSH PRIVILEGES;

EXIT;

Download and Extract WordPress


wget https://wordpress.org/latest.zip

sudo apt install unzip

unzip latest.zip

sudo -R chown www-data:www-data wordpress

mv wordpress /var/www

Add a configuration file for WordPress to Apache


sudo nano /etc/apache2/sites-available/wordpress.conf

<virtualhost>

    DocumentRoot /var/www/wordpress

    <directory var="" wordpress="" www="">

        Options FollowSymLinks

        AllowOverride Limit Options FileInfo

        DirectoryIndex index.php

        Require all granted

    </directory>

    <directory var="" wordpress="" wp-content="" www="">

        Options FollowSymLinks

        Require all granted

    </directory>

</virtualhost>

sudo a2dissite 000-default.conf

sudo a2ensite wordpress.conf

Install additional required packages

sudo apt install libapache2-mod-php php-curl php-gd php-intl php-mbstring php-mysql php-soap php-xml php-xmlrpc php-zip

sudo a2enmod rewrite

sudo systemctl restart apache2

After all of that, access your site and then fill out form in the web browser. Then, you’re all set!


----------------

1. Point your domain to your VPS

You need to make sure eglomyanmar.com points to your VPS public IP.

  1. Log in to your domain registrar (where you bought eglomyanmar.com).

  2. Go to DNS settings or Manage DNS.

  3. Add or edit the following A records:

TypeNameValue (IP)TTL
A@Your VPS IP3600
AwwwYour VPS IP3600
  1. Wait for DNS propagation. This can take up to 24 hours, but usually works within a few hours.

You can check DNS propagation with:

nslookup websitename.com

2. Configure Apache/Nginx to serve your domain

Since WordPress works via IP, you likely have an Apache site like /etc/apache2/sites-available/000-default.conf. Update it for your domain:

Example for Apache:

<VirtualHost *:80> ServerName eglomyanmar.com ServerAlias www.eglomyanmar.com DocumentRoot /var/www/html <Directory /var/www/html> AllowOverride All </Directory> </VirtualHost>

Then enable and reload Apache:

sudo a2ensite 000-default.conf sudo systemctl reload apache2

3. Install SSL (Let’s Encrypt)

Once the domain points to your VPS, you can install SSL using Certbot.

  1. Install Certbot (if not already):

sudo apt update sudo apt install certbot python3-certbot-apache -y
  1. Run Certbot to get SSL:

sudo certbot --apache -d eglomyanmar.com -d www.eglomyanmar.com


Post a Comment