Oracle Open Port 80 and 443
To open ports 80 and 443 on an Oracle Cloud instance, you need to modify the security list associated with your instance’s virtual cloud network (VCN). Here’s how to do it:
Step 1: Log in to the Oracle Cloud Console
- Go to the Oracle Cloud Console .
- Log in with your Oracle Cloud account credentials.
- Select the appropriate compartment where your instance is located.
- Navigate to the Networking section in the left sidebar.
- Click on Virtual Cloud Networks.
- Select the VCN associated with your instance.
- Click on Security Lists in the left sidebar.
- Select the security list that is associated with the subnet where your instance resides. If you are unsure, you can check the subnet details in the Subnets section.
- Click on the Add Ingress Rules button.
- In the Add Ingress Rules dialog, fill in the following details:
- Source Type: CIDR
- Source CIDR: `
- IP Protocol: TCP
- Destination Port Range: 80, 443
- Description: Open ports 80 and 443 for HTTP and HTTPS traffic
- State: Enabled
- Click on the Add Ingress Rules button to save the changes.
Step 2: Verify the Changes
- After adding the ingress rules, you can verify that ports 80 and 443 are open by using a tool like
telnet
orcurl
from another machine:
Check if ports 80 and 443 are open
# Replace <your-instance-public-ip> with the public IP address of your Oracle Cloud instance
telnet <your-instance-public-ip> 80
## and
telnet <your-instance-public-ip> 443
The Oracle instance after the editing a VCN security list should be able to respond to requests on ports 80 and 443. If you see a message like Connected to your-instance-public-ip>
, it means the ports are open and accessible, but more then sure you need edit iptables rules to allow traffic on ports 80 and 443.
Step 3: Login to the Oracle Cloud instance
You can log in to your Oracle Cloud instance using SSH. Open a terminal and run the following command:
Switch to root user
sudo su -
Step 4: Check if server is running on ports 80 and 443
sudo netstat -tuln | grep -E '(:80|:443)'
or
ss -nltp
example output:
LISTEN 0 4096 *:22 *:* users:(("sshd",pid=1011,fd=3),("systemd",pid=1,fd=99))
LISTEN 0 511 *:80 *:* users:(("apache2",pid=15131,fd=4),("apache2",pid=15130,fd=4),("apache2",pid=12702,fd=4))
Step 5: Modify the iptables rules file
nano /etc/iptables/rules.v4
This file contains the iptables rules that are applied at boot time. You can add rules to allow traffic on ports 80 and 443. Add the following lines to allow traffic on ports 80 and 443: Add the following lines just after below routes for ssh 22 port opening:
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
Make sure to save the file after editing.
Step 6: Restore the iptables rules
After modifying the rules file, you need to restore the iptables rules to apply the changes. You can do this by running:
iptables-restore < /etc/iptables/rules.v4