0

I am trying to access an application on my server I have running on port 8000. From the server I can access the application via curl mydomainname.com:8000 from any other machine I just get curl: (7) Failed to connect to mydomainname.com port 8000: Connection refused.

What am I doing wrong?

Here is the output of ufw and netstat.

$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
22                         ALLOW IN    Anywhere
80/tcp                     ALLOW IN    Anywhere
8000                       ALLOW IN    Anywhere
22 (v6)                    ALLOW IN    Anywhere (v6)
80/tcp (v6)                ALLOW IN    Anywhere (v6)
8000 (v6)                  ALLOW IN    Anywhere (v6)

$ netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 :::25                   :::*                    LISTEN
  • Have you tried to connect with the IP address of the server? Does it work when the firewall is turned off? Which entries are available in the host files of other systems? Do you have a DNS server? – A.B. Apr 30 '15 at 16:35
  • Using the IP address results in the same behavior. Running ufw disable doesn't allow me to access port 8000 either. I have nginx serving port 80 and I have no problems with that. – mhinton Apr 30 '15 at 16:43
  • How is your server connected to the hosts you're running your clients on? Can you ping it? Is there a firewall in between them? – nealmcb Apr 30 '15 at 16:46
  • I can ping my server and curl mydomainname.com:80 successfully however curl mydomainname.com:8000 gives me the connection refused error. – mhinton Apr 30 '15 at 16:50
  • 1
    Ugh, it looks like the network on I am on is blocking ports. If I connect to a server on a different network and run the curl mydomainname.com:8000 I get a response. – mhinton Apr 30 '15 at 17:58
0

It looks like your Nginx host isn't set up to listen on port 8000. What does your virtaul hosts file allow?

i.e what does your /etc/nginx/sites-available/mydomainname.com.config allow in it's config?

Here is an example config, what is the listen line say in your config?

server {
        listen   80; ## listen for ipv4; this line is default and implied
        #listen   [::]:80 default ipv6only=on; ## listen for ipv6

        root /var/www/example.com/public_html;
        index index.html index.htm;

        # Make site accessible from http://localhost/
        server_name example.com;
}
| improve this answer | |

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.