AWS EC2 Windows Server 2016 expose port 80 - amazon-web-services

What I'm trying to do is access my webserver on my EC2 from the outside.
Here's what I've done so far:
I've opened all Incoming Traffic to anywhere both for IPv4 and IPv6 in the EC2's Security group
Disabled the firewall from the Control Panel in the EC2 for both public and private
Started my webserver on port 80
From outside the ec2:
I can ping the EC2 succesfully
If I run telnet <my ec2 ip> 80 I get telnet: Unable to connect to remote host: Connection refused
If I run nmap <my ec2 ip> port 80 is not listed
From inside the ec2:
I was able to connect from localhost:80 in EC2's browser
If I ran netstat -aon it shows it is listening on port 80

Make sure that your web server is bound to the external network interface.
Using 0.0.0.0 will ensure that connections can be made from any interface. On the other hand, using 127.0.0.1 (localhost) would have behavior like what you describe, where you can connect to the web server locally, you can reach the host externally (e.g. via ping) but cannot connect to the web server externally.

Is your EC2 instance in a custom VPC? If so, look at attaching an Internet Gateway to the VPC and update the route tables associated with the subnet in which your instance is running.

For this answer I am assuming that you are using IIS as your web server.
1) Start Internet Information Services (IIS) Manager.
2) Expand the left hand panel "Connections" and locate your web server under "Sites".
3) Select your web site. In the right hand panel click on "Bindings".
4) A "Site Bindings" dialog box will open.
5) Under the tab "IP Address" make sure that an asterisk displays so that the server binds to all network interfaces on startup.
5) In the right hand panel under "Manage Website" click "Restart".

Related

How to access a website that is deployed in a Windows instance in EC2?

I have created a Windows instance in EC2, also installed the Bitnami WAMP stack there. The web app runs on the instance, however it does not display on a browser outside the instance with the public IP of the instance.
I have configured the Security Groups this way:
Port 80 (HTTP inbound and outbound)
Port 443 (HTTPS inbound and outbound).
What else need to be done, in order to display the web app on a browser? Thanks
The issue was solved by disable the Firewalls on the Windows O.S directly (instance).

Cannot access from browser on port 3000 even though added to incoming

I created an Ubuntu EC2 instance. I then am running a node.js express server on port 3000. Doing a curl to http://localhost:3000 gives me the HTML string I expect.
However when I try to access from the browser with the Public DNS (IPv4) which is ec2-18-221-209-77.us-east-2.compute.amazonaws.com. It is not loading. The browser spins forever at http://ec2-18-221-209-77.us-east-2.compute.amazonaws.com:3000.
I did put in my security group inbound rules, 3000 for Custom TCP and I set the source to anywhere. screenshot - https://i.imgur.com/2U24qUn.png
I also did netstat -tulnp and it seems :::3000 is open but only on tcp6, do I need it in TCP too? How can I do this? Screenshot - https://i.imgur.com/9jZVZH0.png

Web service hosted on EC2 host is not reachable from browser

I hosted a Python/Flask web service on my Amazon (AWS) EC2 instance. modified the security group rules such that All inbound traffic is allowed.
I can login from ssh and ping(with public ip) is working fine but I couldn't open the service URL from the web browser. Could any one please suggest how can I debug this issue?
Thanks,
It seems that web service isn't up and running or it is not listening on right port or it is listening just on 127.0.0.1 address. Check it with 'sudo netstat -tnlp' command. You should see process name, what IP and port it is listening on.

Amazon EC2 HTTP connection refused, but HTTP port is open

I created a new Ubuntu T2 Micro instance on EC2.
Created a new Elastic IP and selected "EIP used in: VPC"
Associated the address to my new EC2 Ubuntu instance.
I now have a Private IP and a Public/Elastic IP. No Public DNS.
My security group has SSH port 22 and HTTP port 80 open.
I can connect to the instance just fine through SSH using the Public IP, but when I try to browse to the Public IP through the browser it says connection refused. I can't ping it either.
I'm out of ideas.
Amazon EC2 HTTP connection refused, but HTTP port is open
That's already proven by the fact that you got 'connection refused'. If the port wasn't open it would have been 'connect timeout'.
'Connection refused' means that the service you tried to connect to wasn't listening at that port. Possibly it isn't started at all, or even installed.
You need to install a web server on your machine, such as Apache or Nginx. This is not provided by default in EC2.
go to security groups --> edit inbound rules --> add rule (add a custom TCP port 8888 with 0.0.0.0/0 ).
There are two major things that can happen to your web server.
Connection refused :- Which means there is no service running (http/JBOSS/nginx) on your server which is available to accept connections on port specified (which is 80 in this case)
Connection timed out :- Would mean server is not able to process any incoming connection hitting it at port 80. Once you fix the security group and your NACL (if you don't have a default one), then you need to re-check to see if it's service which is giving out the error, not to forget that the error response will change.

Front-Ending an app server on AWS EC2

I have 2 instances set up in EC2. One is running nginx and has an association with the elastic IP address, so its publicly accessible.
The other doesn't have a web server but has a RESTful server running on port 8080.
Both belong to a security group with these rules:
Ports Protocol Source MongoDB-2-2-2-AutogenByAWSMP-
22 tcp 0.0.0.0/0
80 tcp 0.0.0.0/0
8080 tcp 0.0.0.0/0
If I understand that right then port 8080 should be open.
If I ssh onto my web box (with nginx running) I'm trying to test access to my RESTful server on the other instance:8080, so I tried:
curl http://10.151.87.76:8080/1/tlc/ping
curl http://ip-10-151-87-76:8080/1/tlc/ping
curl http://ip-10-151-87-76.ec2.internal:8080/1/tlc/ping
All of these gave me "couldn't connect to host" errors.
If I log onto the RESTful box directly and do the following, it works.
curl localhost:8080/1/tlc/ping
So I know my service is up and healthy.
Any ideas why I can't see port 8080 from the other instance are appreciated.
Make sure instances are in the same availability zone. If not, you may need to access the instance by public DNS name (something like ec2-XXX-XX-XXX-XXX.YYY.amazonaws.com).
Make sure 10.151.87.76 is the correct IP. Note that this will probably change after the instance is stopped and started again.
Make sure your headless service is publicly available -- it may listen on localhost:8080 only but should listen on 0.0.0.0:8080. Try nmap 10.151.87.76 -p 8080 from other instance, it should list 8080 as open port.
Make sure your headless service is publicly available << so this is the reason. What web server are you using for REST API? If it is Apache, make sure config says Listen 8080, not Listen 1.2.3.4:8080. If it is standalone app, make sure it can listen on all interfaces -- some clients will listen on localhost by default. – hudolejev 54 mins ago
This! Buried deep (deep) within my code was a piece of the server wired to "localhost". Changed that to key off hostname and all was well! Happy.