0

Hi I have a nginx server running on a linux machine. I can connect it to from localhost using curl -v http://localhost:8080 fine. But can't connect it to using curl -v http://<machine-ip>:8080, or from browsers in some other machine.

The config file is

server {
        listen 8080;
        listen [::]:8080;

        root /var/www/html;

        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                try_files $uri $uri/ =404;
        }
    }

Port 8080 is being listened to on IPv4 and IPv6, as sudo netstat -tulpn | grep nginx gives

tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      123495/nginx: maste
tcp6       0      0 :::8080                 :::*                    LISTEN      123495/nginx: maste

The firewall is down, as doing sudo ufw status tell status: inactive. I have looked at a lot of answers on various stack exchange sites, but can't figure out the issue. Would appreciate any help. TIA.

1
  • Is the other machine on the same network or behind a router? – LTPCGO Jan 6 '20 at 0:33
0

Since your firewall is disabled, check the nginx log first. Default nginx log can be found here-

vi /var/log/nginx/error.log

vi /var/log/nginx/access.log

If any error is logged then google that for a solution. If nothing in those log files, try reloading or restating the nginx service.

sudo systemctl reload nginx

sudo systemctl restar nginx

1
  • Hi @Prithwi, no error is logged. reload nginx and restart nginx doesn't seem to work – Deepak Saini Jan 6 '20 at 4:32
0

The error was that the port was not open from the Azure side. Follow this to allow incoming traffic on port 8080 as described here, reboot the machine and it works fine now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.