How can I open listen ports on an Amazon EC2 instance?

7

3

I'm using Amazon EC2 micro instance with Ubuntu 11.04 on it (official AMI by Canonical). I have created a new security group for this instance:

Inbound:

22 (SSH)    0.0.0.0/0
80 (HTTP)   0.0.0.0/0
443 (HTTPS) 0.0.0.0/0
3306 (MYSQL)    0.0.0.0/0
8080 (HTTP*)    0.0.0.0/0
27017   0.0.0.0/0
27018   0.0.0.0/0
27019   0.0.0.0/0
28017   0.0.0.0/0

But when I start the web server on 8080 and try to open http://ec2-ip-address:8080/ in my browser it says

Server Not Found

… with the standard Google Chrome page.

netstat -anltp | grep "LISTEN" 

says that my only port listened at is 22.

How can I open the listed ports so I can start my web projects?

EDIT: The solution has been found. All you need is to start server at 0.0.0.0 IP address, not 127.0.0.1 or localhost.

bbrodriges

Posted 2011-11-25T11:32:18.357

Reputation: 171

This solved my problem as well using Google App Eninge on EC2. Have to start it using dev_appserver.py --host=0.0.0.0 to be able to connect from outside. – Guus – 2014-06-18T08:43:58.007

Answers

6

There are a few possibilities here. First possibility is that you haven't set that port up as a listener in Apache, you can do this by adding a line like

Listen 8080

Into you Apache configuration file.

The second possibility is that UFW is running (ubuntu Firewall), you can disable this by running

sudo ufw disable

or add ports to it via

sudo ufw allow 8080

The last possibility is IPTables is blocking it, you would need to look at

sudo iptables -L

to get a list of rules and change them from there.

Kevin

Posted 2011-11-25T11:32:18.357

Reputation: 186

I'm not using Apache, disabled ufw and clear all iptables – bbrodriges – 2011-12-02T09:28:46.917

OK, Sorry, I assumed you were using apache, it seems like whatever is supposed to be listening on port 8080/80/443 etc is not configured/started. What webserver are you using, perhaps I can help with that. – Kevin – 2011-12-03T03:22:05.933

I'm using standard webserver which comes with CherryPy Python web framework. – bbrodriges – 2011-12-05T13:49:59.867

Yes, so that is not starting up, or running. You will have to look into how to start the webserver that comes with CherryPy, as I am not familiar with that. – Kevin – 2011-12-06T02:23:11.690