vrerabek
vrerabek

Reputation: 183

Can't access server_block running on different port than 80 using Nginx

I am trying to run nginx on company server on port other than 80. Since 80 is reserved, I chose port 8082. I need to run it without domain so I could access it using only IP address and port number. Something like this: serverip:8082.

I got it working on my own VPS by configuring server block like this. When i try the same settings on company server, it won't work.

server {
        listen 8082;
        listen [::]:8082;
        ...
}

Some more information

COMMAND   PID     USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
nginx   19668     root    6u  IPv4 20068810      0t0  TCP *:8082 (LISTEN)
nginx   19668     root    7u  IPv6 20068811      0t0  TCP *:8082 (LISTEN)
nginx   19771 www-data    6u  IPv4 20068810      0t0  TCP *:8082 (LISTEN)
nginx   19771 www-data    7u  IPv6 20068811      0t0  TCP *:8082 (LISTEN)
nginx   19772 www-data    6u  IPv4 20068810      0t0  TCP *:8082 (LISTEN)
nginx   19772 www-data    7u  IPv6 20068811      0t0  TCP *:8082 (LISTEN)
nginx   19773 www-data    6u  IPv4 20068810      0t0  TCP *:8082 (LISTEN)
nginx   19773 www-data    7u  IPv6 20068811      0t0  TCP *:8082 (LISTEN)
nginx   19774 www-data    6u  IPv4 20068810      0t0  TCP *:8082 (LISTEN)
nginx   19774 www-data    7u  IPv6 20068811      0t0  TCP *:8082 (LISTEN)
nginx   19775 www-data    6u  IPv4 20068810      0t0  TCP *:8082 (LISTEN)
nginx   19775 www-data    7u  IPv6 20068811      0t0  TCP *:8082 (LISTEN)
nginx   19776 www-data    6u  IPv4 20068810      0t0  TCP *:8082 (LISTEN)
nginx   19776 www-data    7u  IPv6 20068811      0t0  TCP *:8082 (LISTEN)
nginx   19777 www-data    6u  IPv4 20068810      0t0  TCP *:8082 (LISTEN)
nginx   19777 www-data    7u  IPv6 20068811      0t0  TCP *:8082 (LISTEN)
nginx   19778 www-data    6u  IPv4 20068810      0t0  TCP *:8082 (LISTEN)
nginx   19778 www-data    7u  IPv6 20068811      0t0  TCP *:8082 (LISTEN)
server {
        listen 8082;
        listen [::]:8082;
        index index.php;
        client_max_body_size 50M;
        error_log /home/myuser/projects/synt_logs/synt.log;
        access_log /home/myuser/projects/synt_logs/synt.access.log;
        root /home/myuser/projects/synt/public;

        location /{
                try_files $uri $uri/ /index.php$query_string;
        }

        location ~ \.php {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param SCRIPT_NAME $fastcgi_script_name;
 fastcgi_index index.php;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        }
}


When I try to connect to serverip:8082 It just loads then I get ERR_CONNECTION_TIMEOUT.

Can you help me identify the problem I am facing? I am trying to figure this out since yesterday with no success. Thank you!

Upvotes: 0

Views: 789

Answers (1)

vrerabek
vrerabek

Reputation: 183

Ok so the problem is that there was another layer of firewall outside of VPS which blocked the port 8082. By contacting administrator, he fixed the problem for me and it is now working.

Upvotes: 1

Related Questions