0

This is on a fresh install of Ubuntu 14.04 running on a VPS.

For example the following will work:

server {
    listen 8080 default_server;
    root /var/www;

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

server {
    listen 80 default_server;
    root /var/www;

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

When I visit the page it will be my index.html.

But if I try to make nginx listen on another port (35729):

server {
    listen 35729 default_server;
    root /var/www;

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

or even one that's maybe slightly more used (3000 by nodejs servers for example)

All I get is an error saying the webpage is not available. .

Looking in netstat though says that nginx is listening for the port:

tcp        0      0 0.0.0.0:35729      0.0.0.0:*          LISTEN    15349/nginx -g daem

and iptables looks like this (which means no firewall right?)

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

and sudo ufw status verbose yields

Status: inactive

What's going on?

m0meni
  • 178
  • 1
  • 6

2 Answers2

0

Run:

# On Linux
sudo netstat -lntp 

# On FreeBSD
netstat -a | grep 'LISTEN'

# On Windows
netstat -bnp TCP -p TCPv6

and check what port nginx listening

After changing configuration file don't forget

sudo service nginx restart

and check with netstat again, which port nginx listening now

If it's looks right, check your firewall, may be there poked only particular port on firewall.

Do Ctrl+F5 in your browser to refresh cache

P.S. It would be much easier to spot a problem if you will provide your operation system next time you asking question

Alex
  • 139
  • 2
0

I had similar problem and it turned out that I had to open specific port in the customer panel of my server (Ubuntu 12.04) at the supplier's website.

piotrbienias
  • 111
  • 1
  • 3