Search code examples
nginxcentosport

Setting up Nginx: port appears as not opened


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?


Solution

  • If you can access the port 55555 locally it would seem that Nginx has been setup correctly, So I would look more closely at the networking, Possibly something relating to the machine you are connecting from or something blocking that port from allowing connections inbound