B
B
bengur22022-04-04 19:27:01
ubuntu
bengur2, 2022-04-04 19:27:01

How to open port 80 and 443 on Oracle server?

A container is running on the virtual machine.

Dockerfile

FROM nginx:latest

COPY my.conf /etc/nginx/conf.d/

EXPOSE 80
EXPOSE 443


my.conf
server {
    listen 80;
    server_name localhost;

    location / {
        access_log off;
        default_type text/plain;
        add_header Content-Type text/plain;
        return 200 "localhost alive";
    }
}

server {
    listen 80;
    server_name test.com;

    location / {
        access_log off;
        default_type text/plain;
        add_header Content-Type text/plain;
        return 200 "test.com alive";
    }
}

server {
    listen 80;
    server_name site.com;

    location / {
        access_log off;
        default_type text/plain;
        add_header Content-Type text/plain;
        return 200 "site.com alive";
    }
}


launch
sudo docker run --name $DOCKER_CONTAINER_NAME -d -p $PORT_HOST:$PORT_TCP $DOCKER_IMAGE_LATEST


624aad18c2fa0662195570.png

Checking on the virtual machine
curl http://localhost
Returns localhost alive

Opened ports for outside access
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT

sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw enable

624b19f0031e7129033435.png

Further I configure domains.
site.com and test.com are directed to the IP of the server using A-records.

I check here:
https://toolbox.googleapps.com/apps/dig/#A/
The A-record leads to the correct server IP. ERR_CONNECTION_REFUSED
error . For some reason port 80 is closed. I check here: https://portchecker.co/
624b01a084fdb519168375.png
624b0929b5c9f662496203.png

624b1bc4dea21898285833.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2022-04-04
@bengur2

In the control panel in the virtual network settings, you need to add an allowing rule.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question