Mobile app version of vmapp.org
Login or Join
Alves908

: Amazon EC2 Ubuntu instance setting up domain name I had a domain transferred to amazon using their Rout 53. at the begining when i went to the IP address 54.69.253.182, or ec2-54-69-253-182.us-west-2.compute.amazonaws.com

@Alves908

Posted in: #AmazonEc2 #Apache2 #Dns #Domains #Ubuntu

I had a domain transferred to amazon using their Rout 53. at the begining when i went to the IP address 54.69.253.182, or ec2-54-69-253-182.us-west-2.compute.amazonaws.com my site would show up. Currently I have set up some Record Sets in the hosted zones that direct the url(not sure if this is correct or not). Now if you go to either the IP address or the ec2 address it redirects to bracketfanatic.com and shows "Oops! Google Chrome could not find bracketfanatic.com Did you mean: ­bracketfanatics.­com .

/etc/hostname : bracketfanatic.com
apache2ctl configtest returns :

"sudo: unable to resolve host bracketfanatic.com
AH00557: apache2: apr_sockaddr_info_get() failed for bracketfanatic.com
AH00558: apache2: Could not reliably determine the server's fully qualified domainname, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK


sudo hostname ruturns:

sudo: unable to resolve host bracketfanatic.com
bracketfanatic.com


What I need: go to the url bracketfanatic.com or bracketfanatic.com it shows my site.
I am brand new to amazon ec2, so please be specific. Any help or point in the right direction would be nice. If more information is needed, please just ask. Thank you.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Alves908

1 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

Your host name also needs to be added to /etc/hosts in 127.0.0.1 section. If you haven't rebooted since editing /etc/hostname you also need to set the hostname using the hostname command. This normally happens at bootup from /etc/hostname.

Here is a script that I use to make sure the host name is set correctly on my Ubuntu ec2 instance:

#!/bin/sh
set -e

etchostname=`cat /etc/hostname`
if [ `echo "$etchostname" | grep -c '.'` -eq 0 ]
then
echo "ERROR: /etc/hostname does not contain a fully qualified domain name."
echo "edit /etc/hostname and try again"
exit 1
fi

if [ `grep 127.0.0.1 /etc/hosts | grep -c "$etchostname"` -eq 0 ]
then
echo "Adding hostname to 127.0.0.1 in /etc/hosts"
sudo sed -i -r "s/^127.0.0.1([ t].*)/127.0.0.1 $etchostname 1/g" /etc/hosts
fi

hostname=`hostname -f` || true
if [ "$hostname" != "$etchostname" ]
then
echo "Setting hostname to $etchostname"
sudo hostname "$etchostname"
fi




To solve the Apache message you will also have to create a configuration file for Apache using these commands source:

echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/servername.conf
sudo a2enconf servername
sudo service apache2 reload




You also need to set up DNS hosting for your website. To do so using route 53 you would log into the AWS admin console and navigate to route 53. You would then "Create hosted zone". In that hosted zone create records for the base domain (bracketfanatic.com.) and bracketfanatic.com. They could either be A records that point to your elastic IP address (54.69.253.182), or CNAME records that point to ec2-54-69-253-182.us-west-2.compute.amazonaws.com.

You will then need to copy the NS records from that hosted zone into your domain name registrar. If you are using GoDaddy, you would first "launch" your domain. Then you would choose "manage nameservers" and paste in the four values that Route 53 supplied for you.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme