Question

I have a very simple configuration but I only receive a "page not avaiable" as response.

Currently I'm running an Amazon EC2 instance with EBS and RDD and using Route53 as the DNS system. The DNS are correctly working and pointing to the EC2 machine (checked with a nslookup)

In the EC2 machine I created my site in the folder:

/var/www/html/pazzanicastanhas.com.br

and in the file /etc/httpd/conf.d/httpd-vhosts.conf I have only the following

NameVirtualHost *:80
<VirtualHost *:80>
  DocumentRoot /var/www/html/pazzanicastanhas.com.br
  ServerName www.pazzanicastanhas.com.br
</VirtualHost>

When I try to access the site through the domain www.pazzanicastanhas.com.br I just get a error saying the page doesn't exist, if I use the default public DNS or the direct IP of the machine provided by amazon, everything works. The thing is the virtualhost doesn't understand to point the domain to the correct folder in the machine.

Any ideas on what I might be doing wrong?

PS.: The file /etc/httpd/conf.d/httpd-vhosts.conf is being included because if I insert the following line

Alias /pazzanicastanhas /var/www/html/pazzanicastanhas.com.br 

it works just fine by accessing it with the Public DNS provided by amazon with a /pazzanicastanhas at the end, which in this case would be

http://ec2-54-207-88-168.sa-east-1.compute.amazonaws.com/pazzanicastanhas

Was it helpful?

Solution

One thing I notice is that there is no DNS record for www.pazzanicastanhas.com.br, but there is for pazzanicastanhas.com.br:

$ dig +short www.pazzanicastanhas.com.br
$ dig +short pazzanicastanhas.com.br
54.207.88.168

And when you try to load pazzanicastanhas.com.br there is a 301 redirect to the www site:

$ curl -v -s pazzanicastanhas.com.br
[snip]
< HTTP/1.1 301 Moved Permanently
< Server: Apache/2.2.26 (Amazon)
< X-Powered-By: PHP/5.3.28
< X-Pingback: http://www.pazzanicastanhas.com.br/xmlrpc.php
< Location: http://www.pazzanicastanhas.com.br/

But since www doesn't actually exist this will never work.

So it looks like you need to create an A record for www.pazzanicastanhas.com.br that points to your EC2 instance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top