How to Create an Always Free Website on the Oracle Cloud

by

Hey there! Some links on this page may be affiliate links which means that, if you choose to make a purchase, I may earn a small commission at no extra cost to you. I greatly appreciate your support!

In this tutorial, you will learn how to create a website on the Oracle Cloud free tier. Aside from a domain name, this is 100% free website hosting.

Note that if you find Oracle Cloud hosting too complicated, there are many other ways to host a free website.

What is the Oracle Cloud Always Free Tier?

The Always Free tier on the Oracle Cloud has numerous unlimited benefits including the following:

  • Two Oracle Autonomous Databases
  • Two AMD Compute VMs
  • Up to 4 instances of Arm Ampere A1 Compute

This tutorial will show you how to create an AMD compute virtual machine (VM) that is free forever. The specs of the VM are as follows:

  • CPU: 2.0 GHz AMD EPYC 7551 (Naples)
  • RAM: 1 GB
  • Bandwidth: 0.48 Gbps
  • Storage: 50 GB

What Kind of Website Can You Make?

You can make pretty much any type of website on the Oracle Cloud free tier.

In this tutorial, you will learn how to make a WordPress website that runs on a LEMP server which is an acronym for Linux, Nginx, MariaDB, and PHP (note that Nginx is is pronounced like engine x, so that’s where theĀ E comes from). Specifically, we will be working with Ubuntu 20.04 as our Linux operating system.

What About a Domain Name?

Unfortunately, Oracle doesn’t give out free domain names, so you will have to buy one. I get most of my domain names from Google Domains, but you can purchase a domain name from a number of different registrars. I’ll assume that you already have a domain name.

1. Sign Up for Oracle Cloud

Step one is to sign up for a free Oracle Cloud account.

Free Oracle Cloud Account Signup

Please note that in addition to an email and mailing address, you will need to provide a valid credit card. As it states on the Oracle website:

You won’t be charged unless you elect to upgrade the account.

After successfully signing up for your Oracle Cloud account and verifying your email address, continue onto your Oracle Cloud dashboard.

2. Create an Always Free VM

From your dashboard, click on “Create a VM instance” or alternatively, open the menu in the upper left corner and go to Compute > Instances > Create Instance.

After giving your instance a name (I called mine tonysvm), click on the “Edit” button in the “Image and shape” box.

  • Click on “Change Image” and change your operating system to Canonical Ubuntu with OS version of 20.04
  • Click on “Change Shape” and make sure you have the VM.Standard.E2.1.Micro Always Free Elegible Shape selected which is located under the “Speciality and Previous Generation” shape series.

Next, with the “Generate a key pair for me” option selected, click on the “Save Public Key” and “Save Private Key” buttons in the “Add SSH keys” box. This will download the public and private keys that we will use to access your VM via SSH.

Optionally, you can change your boot volume to a size up to 200 GB and still be elegible for the free tier. By default, the boot volume is set to 46.6 GB.

Finally, click on “Create” at the bottom to spin up your free VM. This process can take up to a few minutes to complete.

3. Configure the VM’s Network

By default, the firewall on your VM is locked down. You will need to explicitly allow external connections over the HTTP port of 80 (and alternatively over the HTTPS port of 443 if you choose to install an SSL certificate).

To do this, open the menu in the upper left corner of your Oracle Cloud dashboard and go to Networking > Virtual Cloud Networks > vcn-* > subnet-* > Default Security List for vcn-* and then click on the “Add Ingress Rules” button.

Allow HTTP connections on the Oracle Cloud

Fill out the form with the following information. Leave all other fields blank or unchecked.

  • Source Type: CIDR
  • Source CIDR: 0.0.0.0/0
  • IP Protocol: TCP
  • Destination Port Range: 80

When you are done, click on the “Add Ingress Rule” button at the bottom.

4. Login to Your VM via SSH

In order to access your VM via SSH, you will need to use Putty on Windows, or the built-in Terminal application on Mac. You can find your SSH credentials back on your compute instance’s detail page under the “Instance Access” section.

Oracle Cloud VM login credentials

If on Mac or Linux, in your terminal window, you can issue the following command to connect via SSH while specifying your instance’s public IP address, public key file location, and username.

ssh -i ssh-key-2021-07-25.key ubuntu@129.213.52.59

After successfully authenticating, you should arrive at a screen that looks similar to this.

SSH session after login

5. Update System and Install LEMP Packages

First, update and upgrade your system to the latest version with the following commands.

sudo apt update
sudo apt upgrade

Next, install the web server (Nginx), the database (MariaDB), and the necessary PHP packages.

sudo apt install nginx mariadb-server php-mysql php-curl php-gd php-zip php-fpm

6. Allow HTTP Connections

To allow HTTP connections over port 80 on the server, execute the following commands.

sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 80 -j ACCEPT
sudo netfilter-persistent save

If you are planning on installing an SSL certificate, you will also need to do this for port 443 as well.

7. Setup the Database

Create a database and a database user for WordPress with the following commands. You can access the database command prompt by typing sudo mysql. Please change the username, password, and database name to something appropriate for your system.

CREATE USER 'tony'@'localhost' IDENTIFIED BY 'likecommentsubscribe';
GRANT ALL PRIVILEGES ON *.* TO 'tony'@'localhost';
CREATE DATABASE wpdb;
FLUSH PRIVILEGES;
exit

8. Install WordPress

To download and install WordPress, execute the following commands.

sudo rm /var/www/html/index.nginx-debian.html
cd /var/www
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xvfz latest.tar.gz
sudo chown -R www-data:www-data /var/www/wordpress

9. Configure the Nginx Web Server

We need to tell the Nginx web server about WordPress. Edit the configuration file at /etc/nginx/sites-available/default to look similar to this while adding your own domain name to the server_name field and ensuring that the socket file at /var/run/php/php7.4-fpm.sock actually exists. If a different version of PHP is installed, use that version instead.

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/wordpress;

    index index.php;

    server_name tonys.surf www.tonys.surf;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}

After testing your configuration changes with sudo nginx -t, apply your changes by restarting the Nginx server.

sudo systemctl restart nginx

10. Point Your Domain Name to Your VM’s IP Address

In order to allow users to navigate to your domain name to access your website, you need to add a DNS A record that essentially points your domain name to your IP address. This is typically done at your domain registrar (i.e. the place where you bought your domain name).

In case you are not familiar with this process, here is a video to walk you through it.

YouTube video

11. Finish the WordPress Installation

In a web browser, navigate to your domain name. A page similar to this welcoming your to WordPress should show up.

WordPress install page

Follow the installation, providing the database credentials that you chose earlier. On the following page, you can choose a name for your website as well as a username and password to login to your WordPress administrator dashboard.

Complete the installation by clicking on the “Install WordPress” button. Login to your new website and get to work! In case you’re not familiar with WordPress, here are 15 important things to do after installing WordPress.

YouTube video

In addition to the Oracle Cloud free tier, there are many other ways to host a free website.


Meet Tony

With a background in computer science and engineering, Tony is determined to demystify the web. Discover why Tony is pursuing this mission. You can also connect with Tony here.

13 thoughts on “How to Create an Always Free Website on the Oracle Cloud”

  1. Tony, I’m facing a problem while uploading plugins bigger than 2 MB. Showing error “413 Request Entity Too Large”
    nginx/1.18.0 (Ubuntu)
    How do I fix it? I have already increased the upload limit in php

    Reply
  2. I have managed to solve that Tony just needed to add a code in config file client_max_body_size 100M;

    But I have one more issue with is the Rank Math sitemap link isn’t working. They are asking me to add a bit of code but I don’t know where to add it.

    Reply
  3. Hello,

    I’m wondering if you have tried any of the hardening techniques on the Oracle always free tier. running the audit, I’m getting some really bad results. I’d be interested in seeing what things you did and didn’t do for hardening?

    ssh-audit.com

    Reply
  4. Thanks for your detailed video, I was stuck because I was unable to access mongodb database remotely because of some firewall issues but your video just made my day, the iptables part helped me to resolve my issue.

    Reply
  5. Hey Tony awesome content I just have query if I want to host multiple site need to 1. create one more directory at var/www/html/folder1 for WordPress content and 2 at etc/nginx/sites-avaliable need to create one more .conf file and make change to rootdoc and service name and one more doubt about ownership chown -R $www-data:$www-data var/www/html/folder1 am I right apart? If yes apart from this anything else

    Reply
  6. hello Tony,
    thanks a lot for this one,
    Qn: kindly asking, do you know any way or an option of getting an always free VPS ?
    thanks

    Reply

Leave a Comment