Domain resolves IP returns apache is functioning correctly

telfordl

Verified User
Joined
Mar 6, 2011
Messages
10
Newbie question. I have been struggling with this for hours and have read just about every thread I can find. I am running on a VPS. My domain, utahmetaldetectors.com correctly resolves to the default index.html and is pointed to the correct IP. If I use the IP address to go to the website it returns 'apache is functioning correctly' I am assuming that this is not acceptable.

I have my server and DA running on this same IP. I am the only admin and have set up the domain directly under my admin. The nameservers are setup under this main ip and an extra on that I have used. I have no resellers and no other users at this point.

What am I doing wrong that I cannot get the IP to point to my default index.html? I am exhausted trying to figure this out.
 
Any Help??

I know others have a life, but I really need help on this. All of my other domains on this account resolve correctly with only an IP address. My main account is the problem. I don't want to continue building much until I find out more.

I do beleive that httpd-vhosts.conf may not be getting my vhosts conf for for my main domain even though I am seeing the include line in the httpd-vhosts.conf file. Could it be a permissions thing?
 
It is not a permissions thing. What you are seeing, is the way name based web servers work. When accessing via http://ip-address it will by default, serve the page from /var/www/html, where as the name based web page should be server from /home/$USERNAME/domains/$DOMAINNAME/public_html . You could do some links or forwards in /var/www/html to serve the page locate in /home/admin/domains/$DOMAINNAME/public_html since that one should match the main domain name.
 
Thank you very much for the reply. So....why do my other domains resolve by IP? Is it because this is the default domain? I will try the link to see how that works, but if it is something deeper, I want to get it right.
 
What gets displayed is very dependent on what your httpd.conf file looks like. If you have a DocumentRoot set that is outside of <VirtualHost> tags, then that is the default web site and will be the one resolved by http://999.999.999.999 type urls. The ones listed in between <VirtualHost> tags are resolved by name not IP. The DNS lookup will return an IP address of your server, but apache sees that the name is being requested and will serve the site listed in the DocumentRoot for that <VirtualHost>.


DirectAdmin by default has the main DocumentRoot set as /var/www/html and the VirtualHost DocumentRoot set as /home/$USER/domains/$DOMAIN/public_html. To achieve what you are looking for, you can do one of two things, change the DocumentRoot in the /etc/httpd/httpd.conf to point to the location of your site (possibly /home/admin/domains/$DOMAIN/public_html) or make soft links so that the same files are being served from both locations.
 
Great information. So the question that I am left wondering is, why do IPs resolve for all other domains except this one?? I will take your advise and try the fix. I am just worried that something else is awry.
 
I have two other domains on this server that resolve to the home page when I enter their IPs. The only domain that doesn't do this is my main domain utahmetaldetectors.com . If I enter it's IP I get the 'apache is functioning correctly'. That was the problem. If I enter the domain name then it resolves correctly and I get the expected home page. I am seeing this IP reverse resolution problem only on my default domain.
 
Based on what you said, I assume that the other two domains have their own IP addresses, that makes sense. They are virtualhosts, but since they have their own IP addresses, they will resolve via the name and IP address. If the IP was shared between multiple hosts, only one of them would be displayed when the IP address was used (usually the first one in the httpd.conf). Your main domain is using the shared IP address, so it will not resolve exactly the same way.

You could also delete the /var/www/html/index.html and create an index.php there instead that has:
Code:
<?php
header("Location: http://utahmetaldetectors.com");
?>

That way anyone attempting to use the IP will be redirected to the name based domain.
 
Tom,
Thanks for the help and for the information. It has been very valuable. I appreciate you taking the time to explain this to me. :D
 
Back
Top