EC2 public instance not accessible - apache

I am facing this issue as I am new to AWS EC2. I have setup an instance and ssh working perfect. I installed httpd, mysql, php and httpd and mysql services running fine.
I can't access EC2 public DNS in a browser. I already added a rule for HTTP with port 80 but still not working. What can be the other reasons?

For this trouble shoot like below :
Step 1) ssh to instance and stop the iptables if it is running.
Step2) if above step not resolves the issue, please post the log out put of browser. is it 404 error or DNS not found or 403 something like that. Then I can assist you.

Related

How do I set up Openshift Origin router

I am trying to stat an Openshift Origin single-node instance on a centos VM.
After installing docker and oc client tools I ran this command:
oc cluster up --public-hostanme=MyHostname --routing-suffix=MyHostname.nip.io
Everything seems to be working, except when I deploy an app, the router defined for it always routes to nginx welcome page, not my app.
Anyone know how to solve this?
So I managed to solved it. I found out that nip.io only works with the server ip, not domain name. I got the routing-suffix to work with the hostname by setting the routing-suffix to MyHostName.dom and adding a wildcard dns record that resolves *.ose-spank.dom to the server ip. (Since I don't have dns server I used Acrylic DNS as a dns proxy)

Apache server does not show up on EC2 IP

I am trying to install apache2 on my EC2 instance.
I did the following steps:
Launched an Ubuntu 16.4 instance with security group details
http - 80 - anywhere
https - 443 - anywhere
Once I login to my instance I did
sudo apt update
sudo apt install apache2
when I type
service apache2 status
it says that Apache is running
I assumed that after this if I go to my public IP address [xxx.xx.xx.xx] I would see the default apache server page.
But I see This site can't be reached.
The process seems pretty straightforward, what am I doing wrong?
I had this stupid case, it made me reinstall dozens of times.
Maybe my Security groups don't allow https://
Replace https:// with http:// if available.
It will work perfectly.

Can't Access to my Amazon Instance with public Ip

I have a new amazon instance EC2, and I want to build a Web Server so I did :
Install apache2
Install libapache2-mod-php5
a2enmod rewrite
Add a Http rule in the default group to allow all IP
add Directory AllowOverride All in /etc/apache2/sites-availables/ default-conf
But when I want to check if apache is running by typing the public ip of the instance in my browser, I dont have the basic index.html "it's works". I got nothing.
What does i missed ?
Thanks you.
If apache is running fine, then it might be the firewall.
In the AWS console, make sure you have unblocked port 80 in the "Security Groups" under "Network & Security".
I found the solution.
It was a problem with the firewall.
The security group that I changed was not the one that was linked with my Instance
My bad.
do you know if the apache is running? you can check with:
ps aux |grep -i 'http\|apache'
if it has not started, you can try:
/etc/init.d/httpd start

Can ping ec2 server (ubuntu/apache) but don't get response from http request

Background:
OS: ubuntu
Web Server: apache2
What works:
I can ping the server's elastic IP (and receive a response)
I can ssh into the server
What doesn't work:
I cannot get any sort of http response from the server
Expected Behavior:
When I go to http://ec2-XXX-XX-XXX-XXX.compute-1.amazonaws.com/, it will serve my page, or at least give me a 404 that I can debug
Actual Behavior:
When I go to http://ec2-XXX-XX-XXX-XXX.compute-1.amazonaws.com/, it says "Oops! Google Chrome could not connect to ec2-XXX-XX-XXX-XXX.compute-1.amazonaws.com". It doesn't even give me a 404.
Rant:
Clearly the server is there because I can ssh in to that exact address and I can ping that exact IP and get a response. But when I go that exact address in my web browser it's as if it never makes it to the server. Or it's as if Amazon isn't letting http requests through, but in my security group I am clearly specifying that http requests from all sources are allowed through. Apache is definitely running, my document root is definitely set up properly, and my error and access logs don't give me anything.
Is there any sort of log in between Amazon and the server, or in between requests making it to the server and being received by Apache that would specify why it's returning "not found" rather than a 404. Can I make my Apache logs more verbose?
Thanks in advance! I've spent hours on this....
Turns out apache was set to listen on port 8080 rather than port 80, so if you encounter this problem, try taking a look at what apache's listening to.

DNS problem - dig resolves but curl cannot connect to host

I have recently created a Rackspace cloud server instance using CentOS 5.5. I have used yum to install the "Web Server" group (it includes Apache, etc.), added www.booztrakr.com as the ServerName in httpd.conf, made sure iptables allows on port 80. I had registered this domain with Go-Daddy and changed their name servers to the Rackspace name servers on their site. I added "A" and CNAME records to the Rackspace name servers. httpd has been started. When I use curl on the server I can get the Apache landing page. When I dig www.booztrakr.com from a remote machine(over the internet) the answer section returns:
www.booztrakr.com. 300 IN CNAME booztrakr.com.
booztrakr.com. 300 IN A 184.106.216.156
When I try a browser or curl, it can't connect:
curl -G www.booztrakr.com
curl: (7) couldn't connect to host
I know this has got to be pretty basic and config related but I'll be dammed if I can see it. Any help would be appreciated. Thanks.
If dig resolves, this just means the DNS server returns the right values. It will even work if the IP doesn't exists.
If a HTTP connecting to the server fails, this is a configuration problem.
The server responds to ICMP requests, so it's not a routing problem.
When I use curl on the server I can get the Apache landing page
Your webserver is running, but you just can't reach it from outside. This is the problem. What does iptables --list outputs?