Open port 80 on Ubuntu server
There is no program listening on port 80 so it's closed and you can't connect to it.
You can use
sudo python -m SimpleHTTPServer 80
to start a simple web server listening on port 80, or install something like Apache (package apache2
) if you want a full blown web server.
UFW is the Uncomplicated Firewall. It manages what ports on your computer can be opened for listening by an application. sudo ufw allow 80/tcp
means allow TCP connections to port 80.
However, there is nothing actually listening in behind the port. To curl
the port, there should be an application that will send a reply. This is typically called a server. As @Florian points out, you can use Python's SimpleHTTPServer
to test it.
Use:
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
Then to prevent it from losing the iptables configuration on restart, use:
sudo apt-get install iptables-persistent