Score:0

Setting up Nginx: port appears as not opened

br flag

I have gained access to a CentOS 8 machine which already has a web running on port 80. I have checked that there are no firewalls running (neither firewalld nor ufw). My idea is to set up a Django web running on port 55555. Therefore, the first thing that I am trying to achieve is displaying the default Nginx page from outside the machine.

Currently, my Nginx configuration is as follows:

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       55555 default_server;
        listen       [::]:55555 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

# Settings for a TLS enabled server.
#
#    server {
#        listen       443 ssl http2 default_server;
#        listen       [::]:443 ssl http2 default_server;
#        server_name  _;
#        root         /usr/share/nginx/html;
#
#        ssl_certificate "/etc/pki/nginx/server.crt";
#        ssl_certificate_key "/etc/pki/nginx/private/server.key";
#        ssl_session_cache shared:SSL:1m;
#        ssl_session_timeout  10m;
#        ssl_ciphers PROFILE=SYSTEM;
#        ssl_prefer_server_ciphers on;
#
#        # Load configuration files for the default server block.
#        include /etc/nginx/default.d/*.conf;
#
#        location / {
#        }
#
#        error_page 404 /404.html;
#            location = /40x.html {
#        }
#
#        error_page 500 502 503 504 /50x.html;
#            location = /50x.html {
#        }
#    }

}

Also, the port 55555 appears as opened: enter image description here

The Nginx default page is displayed when accessed locally, but when trying to access the webpage (192.XXX.XXX.XXX:55555) from another machine, I get that the port 80 is opened and it can be accessed but the port 55555 is not opened.

Any clues of what am I missing in order to configure Nginx to retrieve the default webpage when accessed from the outside?

in flag
Please provide the actual error message you encounter, not just `is not opened`.
qwerty avatar
br flag
@GeraldSchneider the thing is that I am not getting an error message. It is just that when I curl the 192.XXX.XXX.XXX:55555 from another machine, I get a timeout, but when I do it to the other port, 92.XXX.XXX.XXX:80, I get the response from the other running web, so I do not know where to look in order to view why the port 55555 is showed as closed.
in flag
A timeout is an error. And it's the important part. A timeout points toward a firewall issue.
digijay avatar
mx flag
On CentOS you have to explicitly open that port with `firewall-cmd --zone=public --add-port=55555/tcp --permanent` and then reload the configuration with `firewall-cmd --reload`
qwerty avatar
br flag
@digijay but the thing is that I am not using firewall-cmd, it is deactivated and without firewall-cmd the web on port 80 is running as expected.
in flag
Then there is a firewall outside of the machine.
digijay avatar
mx flag
Just to make it sure, do you get any output for `iptables-save | grep 55555` or `lsof -i -P |grep http`?
qwerty avatar
br flag
@digijay, no, I do not get any output.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.