Flask port 5000 blocked

May 21, 2017 901 views
Python Ubuntu 16.04

I am running the Flask tutorial here: https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-14-04

and have set my ufw permissions like so:

sudo ufw allow 5000/tcp

but am still not seeing anything

If I login into a seperate session, and do:

curl localhost:5000

I see the website.

Any suggestions?

2 Answers

@davidreedc

Try running ufw disable to disable the firewall, then attempt to connect. If you're able to connect with the firewall down, you may need to reset and reconfigure the firewall.

We can do that by running the following commands, after the above command:

ufw reset
ufw default deny incoming
ufw default allow outgoing

Now we need to at least allow ports 22 and 5000 in, so we'll go ahead and add those first:

ufw allow 22/tcp
ufw allow 5000/tcp

Once you've ran each of those commands, we'll re-enable ufw:

ufw enable

Make sure you allow port 22 -- not allowing that port means you won't be able to SSH in, thus you'd either be locked out (if you're using SSH Keys) or would need to access the console (if you're using passwords).

@jtittle thanks for the help. I mistakingly setup iptables following the 14.04 instructions. I flushed those and am all good now. Thanks!

Have another answer? Share your knowledge.