H
H
hiddenproger2020-05-10 13:48:58
CentOS
hiddenproger, 2020-05-10 13:48:58

How to close the port from the outside?

there is a rented virtual server, nginx is installed on it,
sites on nodejs are raised on different ports, but these ports look outward (to the global Internet)
and the sites are available at the following address http://domain:5000 or http://domain:7000 and one the domain on different ports shows different sites
, I want to make sure that there was no such access to the ports and the sites were opened only by the domain
in the nginx config, the sites are proxied like this

location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
     }

how to close access on ports from the outside?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-05-10
@q2digger

iptables -I INPUT -p tcp -i eth0 --dport 5000 -j DROP
options - port, interface to taste.
But it's better to close everything and leave open only what you need (for example, 80, 443 and where you have ssh hanging there)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question