How to Open Ports 80 and 443 on Oracle Cloud Infrastructure (OCI) Ubuntu Instances
The most frustrating moment of my early hosting journey was installing Nginx on my first Oracle VPS, seeing the service status as "active (running)", and getting a blank "Connection Timed Out" screen in my browser. I spent 4 hours checking my config files, only to realize that Oracle Cloud is locked down tight by default. You have to open ports both in the OCI dashboard and inside the virtual machine's local OS. If you are preparing your server for a WordPress install, read our comprehensive walkthrough on Setting up WordPress on Oracle Cloud Free Tier.
Billing tip for Bangladesh developers: If you are managing servers for local clients, managing firewall rules for OCI or AWS manually can lead to security gaps or downtime. A simpler, risk-free alternative is utilizing RackUp IT's fully managed cloud servers, payable locally in BDT via Bkash or Nagad. To understand how server location and performance affect your bottom line, read our analysis on Idaho Web Hosting needs.
Step 1: OCI Console Ingress Security Rules
First, we need to instruct Oracle's network firewall to allow incoming traffic on web ports.
1. Log into your Oracle Cloud Console.
2. Go to Compute > Instances and click on your instance.
3. Under instance details, click on your Primary VNIC's Subnet link.
4. Click on the Security List for the subnet (usually "Default Security List").
5. Click Add Ingress Rules and add rules with Source CIDR 0.0.0.0/0, IP Protocol TCP, and Destination Port Range 80,443.
Check out our Managed Shared WordPress hosting
Oracle's Ubuntu images contain iptables rules that block incoming traffic even if OCI security rules are open. Connect to your instance via SSH and run the following commands to open ports 80 and 443:
sudo iptables -I INPUT 6 -p tcp --dport 80 -j ACCEPT
sudo iptables -I INPUT 6 -p tcp --dport 443 -j ACCEPT
sudo netfilter-persistent save
sudo netfilter-persistent reload
Step 3: Verification
Once both steps are complete, check if your web server responds by running curl -I http://localhost locally, and then trying to visit your server's public IP address in a web browser. If it loads the default welcome page, your ports are successfully open!
Frequently Asked Questions
Why does Oracle Cloud block ports by default? Oracle Cloud Infrastructure (OCI) uses a "security-first" design. By default, all incoming traffic is blocked to protect your Virtual Machines from unauthorized access and potential exploits. You must explicitly declare which ports (like port 80 for HTTP and port 443 for HTTPS) are allowed to receive traffic.
What is the difference between OCI Ingress Rules and the OS Firewall? Think of OCI Ingress Rules as the security gate at the entrance of a building (the cloud network layer), and the local OS firewall (like iptables or ufw) as the locked door to your specific apartment (the Virtual Machine). To allow visitors in, both the security gate and the apartment door must be open. If either is closed, the connection will time out.
Why does iptables block traffic even if UFW is disabled? Oracle's default Ubuntu images come preloaded with raw iptables rules that take precedence over user-friendly tools like UFW. Even if you turn off UFW, the active iptables rules in the Ubuntu image will continue to block port 80 and 443 until you insert the rules manually using iptables -I INPUT ....
My rules disappear after I reboot my Oracle instance. How do I fix this? This happens when you do not save the new firewall state. Running sudo netfilter-persistent save writes your current active rules to a persistent configuration file. On reboot, the netfilter-persistent service automatically loads these saved rules back into iptables
RackUp IT - View Cloud Hosting Plans
Click the button below to learn more and get started.
View Hosting Plans