Running a Web Server on Oracle Compute Instance

Every website sits on a computer which is basically as a Web server. A web server processes requests via HTTP(s) and other related protocols.

There are several web servers out there, but i shall focus on installing Apache HTTP server on Oracle Linux and Ubuntu operating systems running on Oracle compute instances.


  • Oracle Cloud Infrastructure compute instance
  • SSH Client ie. PuTTY
  1. Installing Apache HTTP on Oracle Linux.
Install Apache http
sudo yum install httpd -y

Start Apache server and configure it to start at system reboots

sudo apachectl start
sudo systemctl enable httpd

Check if the Apache configuration syntax is correct, run:

sudo apachectl configtest

Now create firewall rule to access all ports that HTTP listens to.

sudo firewall-cmd --permanent --zone=public --add-service=http

sudo firewall-cmd --reload

Find the web root directory for your web server and add your web files. ( Found at the “/var/www/html” folder)

One more thing!

Open port 80 in the security lists of your compute instance. 

Navigate to your compute instance and select your VCN.

Click on security lists on the left bar under resources and select the default security list for your VCN.

Add an ingress rule for port 80, edit the values as shown on the image below.

Source Type: CIDR
Source CIDR:
IP Protocol: TCP
Source Port Range: All
Destination Port Range: 80

Click on Save Security List Rules at the bottom.


Almost done now…

Create an Egress rule to allow traffic for all ports.


All done!

To test open your  favorite web browser and navigate to the public IP address of the Linux VM.



I have configured DNS to resolve to my public IP address on my Oracle compute instance. I will show you how to do that on the next post 🙂

It works!

2. Installing Apache HTTP server on Ubuntu

The whole process of configuring the compute instance security lists is the same as above, only the commands for installing Apache on Ubuntu change a little bit.

Log in to your compute instance running on Ubuntu using SSH.

Search the Apache package:

apt-cache search apache

Install the Apache2 package using the root privileges.

sudo apt-get install apache2

Where is the Apache HTTP server installed?

To find out,  run the find command:

sudo find / -name apache2


Navigate to your web root folder and add your web files. (Found at /var/www/html)

Test out your web browser using your favorite browser.


Final Thoughts:

Apache HTTP server is an open source cross platform web server software which can can also act as an application server. There are several other web servers out there ie. Nginx, IIS etc.


Thank you and Happy coding! If you liked it, share it!

This blog reflects  my own thoughts and doesn’t reflect the thoughts of my employer.

Author: Labanish

I am a Senior Cloud Solutions Architect at Oracle. Am interested in Cloud Automation, Cloud Native Applications dev and Emerging Tech. I have over 6 years work experience handling different tech roles in East Africa, Romania & now in United Kingdom. All views are mine.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: