Amazon EC2 - Issue Connecting to Public DNS - amazon-ec2

I am facing a few issues.
I initially had assigned an elastic IP to my micro instance i-38cbc940, but for some reason, after I did that the webpages I had uploaded were not functioning properly (images not loading correctly, etc).
I tested this prior to the elastic IP assignment and such problems were not occurring. So I dissociated the elastic IP address and released it. Then, I reboot my instance.
The problem is, now I cannot view my site in a browser using the public DNS address listed (ec2-23-23-18-52.compute-1.amazonaws.com) or any of its sub-directories.
Things I Know:
My security settings have not changed - I still have the same security group identified with the instance.
httpd.conf file still shows "/var/www/html" as the DocumentRoot.
Every time I navigate to the public DNS address listed...it shows "could not connect" but if I ping it, it works.
If I SSH into the instance in the var/www/html directory, everything is still there, including an index.html file that was viewable before. Also, I can get into the instance through PuTTY.
Also, no sure if it's important, but this is an AmazonEC2-AMI/Apache/MySQL server with Wordpress CMS installed.
Any ideas on what could be going on here?

you need to check the apache conf for any hardocoded dns entries of your instance amazon dns and also check your code for any referrals to the amazon dns of your instance.

Related

Redirecting IP to AWS results in NGINX landing page

I have a portfolio site hosted on AWS. When I first deployed the site to AWS, a site built in Ruby, I installed NGINX on the AWS instance. I went to register.com and redirected the IP address of my domain to point to the public IP address of the AWS instance. Everything was working fine. The site could be accessed with the AWS IP address or the domain name.
Things were fine until AWS retired the server my instance was on. I created a new instance and a new .pem key and deployed to the new instance. I repointed my domain the new AWS instance IP address. I can access the site without issue when using the IP address, 54.173.8.232. If I try and access it through the domain, http://www.williamjpalmer.com, I get the Welcome to NGINX landing page.I have deleted the previous instance thinking that maybe it was preventing the site from loading. I do not know very much about setting up servers and how to resolve issues like this. I would appreciate any help on this. It is frustrating that it worked the first time but now will not.
Thanks for any help.

why does my domain name immediately switch to showing its ip address once page loads?

I just registered a new domain name and set it to point to an AWS EC2 instance. When I enter the domain name, it loads fine, but then as soon as the page loads, the browser address text is updated to show the ip address (replaces the domain name). I cloned this EC2 from another server where this was not happening and where I hadn't done any non-default Apache2 server settings other than URL shortening to remove .html and .php file extensions. Any ideas what could be happening here? I tried it on multiple computers and multiple browsers.
Sounds like your webserver is issuing a redirect after the first connection is made, and the redirect is pointed to the IP adress of the server. You can get more information to confirm this by using Chrome Network Console.
In this case I had mistakenly updated the DNS record for forwarding rather than for the # tag, so it was forwarding to the site.

Configuring Amazon EC2 for a dynamic website

I am curious about Amazon webservices and so I thought of creating a dynamic webpage with Amazon EC2. I created an instance, installed apache and php and made sure it is working in EC2(using remote access). I have assigned a elastic IP to the instance. My question is how to access the webpage that I created in the instance. I am not sure what to give the servername in httpd.conf. My goal is access the page like http://amazonaddress/test.php
I am using windows server, but I think it is basically the same. My documents are in the same folder as mentioned in conf file. But when I use my elastic IP, it isn't working . Not even the basic index page in the apache htdocs(that's the home folder according to conf). To throw more light I will explain what I have done till now.
I have created a micro instance(EC2) and logged into it using remote desktop. I have installed apache msi file and php after that. I have created a elasticIP and attached the instance and to my security group I have added http service to port 80. I have tested if localhost is working in my remote machine(points to index.html). After that I have tried accessing it using elastic IP and it just times out. Is there any step I have missed?
You can access it via http://255.255.255.255 where you replace the 255.255.255.255 with your elastic IP address.
Then you want to setup DNS for your domain name. So you'll need to create an A Record mapping www.yourdomain.com to whatever your elastic IP address is. You can usually do this via your domain name registrar as most of them also run basic DNS services for free.
You can access an ec2 instance using it's public DNS name (or elastic IP since you already have one of those), which can be seen in the instances description tab. Configuring your personal domain name to point to that server will involve creating an A Record mapping to that public IP.
Assuming apache has been setup correctly, that's all you should need to do to get started (and your test.php page is in /var/www/). For your purposes, you probably shouldn't even need to modify the httpd.conf file at all.
Also, be sure to remember to open a port on the security group (under Network & Security from the EC2 Console) that the instance belongs to. In your example, you will want to open port 80 inbound with source 0.0.0.0/0 (unless you want to limit access to a specific IP range).
Hope this helps.

amazon ec2 - name server issue

i have created new instance in amazon ec2, and assigned the elastic ip for instance. But i need to know how to get ip for name server (ns1.abc.com, ns2,abc.com).
I have installed whm in amazon instance. Only domain cannot point to the correct name server. That is because ip cannot load.
Now, my problem is that how i get new ip. Can i add another two elastic ip in amazon? But i configured two elastic ip for name server in dns zone within whm. The name server is not working. And i cannot open the elastic ip in browser. I am confuse for it. Please anyone help me.
There are lots of things that can go wrong here. I'll try to troubleshoot step by-step:
I'll assume the goal is "You want to type 'whm.foo.com' and see your WHM"
1) Go to your domain registrar and make an entry that points "whm.foo.com" to your EIP. (Depending on what you want, maybe you should setup a "*.foo.com" wildcard for that EIP.
2) Test that step #1 worked by typing "ping whm.foo.com" or "dig whm.foo.com" (one linux/mac, not sure about Windows). This should return your EIP. If not, go back to step 1.
3) Check that WMH is acually running. Read the docs to find what port it's running on. (Usually 2083, or 2082 for insecure access)
On your instance, run "curl -v localhost:2083" (or whatever port. It should return a login screen. If it says "couldn't connect to host", then you have the wrong port or it's not running.
4) run "netstat -na | grep :2083" (or whatever port). It should say "0.0.0.0:*". If it says "127.0.0.1:*", then you need to configure it to allow outside access.
5) Make sure your WHM port is enabled in the AWS firewall. Go to the AWS control panel and find the security group for your box. Make sure that port is allowed. Ideally, you'd only add your personal IP instead of opening it up to the world. (If there is a bug in WHM, people will scan all IPs trying to exploit it. They can't exploit your server if the AWS firewall denies them access.)
6) Now type "https://whm.foo.com:2083" (or whatever port) in your browser. (or http://whm.foo.com:2082 for insecure access). It should work!
i need to know how to get ip for name server (ns1.abc.com, ns2,abc.com).
As rdrey said, you need to go to your DNS provider (most registrars also do DNS) and tell them what boxes should point to your EIP.
That is because ip cannot load.
There is no such thing as "ip cannot load". Either "DNS is giving the wrong IP" or "some IP operations (TCP ports) were blocked by a firewall somewhere".
Now, my problem is that how i get new ip
I don't think that should be your goal. You can easily change EIPs, but it won't fix the problem. Nothing works unless everything in between is set up correctly. The goal should be understanding all the steps in the process and verifying that each step was done correctly.
OK, you have two options here:
Use the DNS servers provided by your Domain Registrar OR
Use AWS Route53 to let Amazon provide DNS services for you.
Option 1:
You bought your domain name from a registrar, like one of these: http://lifehacker.com/5683682/five-best-domain-name-registrars
Most, if not all, registrars run a free DNS service for their customers. You should be able to log into some kind of management console and set your domain's DNS zone entries to point at your AWS EIP. (I am using gandi.net and used to use godaddy. You simply leave the DNS Servers as they are and set your AWS EIP as the 'A' record.)
Option 2:
Go to https://console.aws.amazon.com/route53/home and follow instructions. I haven't read up on Route53's pricing, so this option might not be free.
---- EDIT:
Some more help:
The site you've linked to (http://www.intodns.com/xantec.com.sg) states that you've used your EIP (54.251.169.7) as the nameserver for the domain. You don't want that. You're running a cPanel installation, NOT a DNS nameserver.
Put 54.251.169.7 as your site's A record. (Sometimes called the www field.) Remove it from the NS fields and put ns3.thesimpledns.com & ns4.thesimpledns.com into those.

host network solutions domain on an amazon ec-2 box

I have looked this up and what was described in other answers did not work for me. I created a elastic ip from my ec-2 dashboard, and I set the A records of my domain (www, *, and #(none)) but it does not work. When I try to go directly to the ip address it also does not work though so I am not sure why this is happening.
Also where exactly does the elastic ip point? To my home folder, to the ec-2 user? It is not working now so I couldn't test it, but when it does work I still won't know.
Two things: remember that your domain will need to propagate, so leave it a few hours. Also, your elastic IP points to the machine you bound it to.
Almost forgot, you also need to edit your security zone to open up ports to allow incoming connections on those ports, as the default is to block everything except SSH.

Resources