Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
20
rated 0 times [  20] [ 0]  / answers: 1 / hits: 216617  / 2 Years ago, mon, may 30, 2022, 3:14:46

I'm just starting out in Ubuntu/Linux, and have some trouble opening port 80 for incoming connections.



I ran the sudo ufw allow 80/tcp command, and when I run sudo ufw status the result looks like this:



Status: active

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


However, I still get this error when trying to connect to the port with cURL.




Failed to connect to MY_IP_ADDRESS port 80: Connection refused




When I run this command netstat -ntlp | grep LISTEN to see what ports are open, I get this result:



(No info could be read for "-p": geteuid()=1000 but you should be root.)
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -


Which doesn't look that promising..



How do I open port 80 for incoming connections?


More From » networking

 Answers
7

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

For Python-3:


sudo python3 -m http.server 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.


[#19173] Wednesday, June 1, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
byishted

Total Points: 469
Total Questions: 113
Total Answers: 113

Location: Tajikistan
Member since Sun, Aug 29, 2021
3 Years ago
;