How To: Configuring Oracle Cloud Virtual Machine as a webserver

How To: Configuring Oracle Cloud Virtual Machine as a webserver

BitmapBytes.com uses the Oracle Cloud to host this blog - in a 6 part series I will be taking you through how you can quickly and easily spin up a website with 200gb of free space hosted on the Oracle Cloud. Connect it with your domain with https support, setup the domain with free email service for 5 emails provided by ZOHO mail - and finally install the Ghost blogging platform and configuring it with Mailgun for sending out newsletters to your followers.


SSH into your Oracle Virtual Machine and lets setup the webserver and install NGINX, MySQL and Node.js

# Install NGINX
sudo apt-get install nginx

# Install MySQL
sudo apt-get install mysql-server

# Add the NodeSource APT repository for Node 16
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash

# Install Node.js
sudo apt-get install -y nodejs

Next open the ports on your webserver:

# HTTP :80
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 80 -j ACCEPT

# HTTPS : 443
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 443 -j ACCEPT

# MAIL :587
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 587 -j ACCEPT

# Save the settings
sudo netfilter-persistent save

Lets now setup the Ingress rules to enable traffic through the virtual network onto the cloud instance!

Head back to cloud.oracle.com from the Cloud Dashboard open up "Networking" and then select "Virtual Cloud Networks".

Select the "Virtual Cloud Network Name" (Mine is vcn-20220628-1617)  

Select the "Subnet Name"

Select the "Security Lists Name"

From here you can manage your ingress/egress Rules.

Select the "Add Ingress Rules" button.

Add the Port number to "Destination Port Range" where you want to allow traffic through.. - I've done this for:

  • HTTP port 80
  • HTTPS port 443
  • MAIL port 587

Lets check the NGINX placeholder page is up and running

Open up a browser and load up http://{YourVMPublicIP} you should see Welcome to nginx!


If you want to make any changes to the webpage open up a terminal to your VM instance.

# Goto the NGINX webserver base path
cd /var/www/html/

# Modify index.nginx-debian.html and save back to the server

Now refresh the page and you should see your changes!


Congratulations you now have a free forever Ubuntu webserver running in the Oracle Cloud where you can host and run anything up to 200GB for free!