Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

virtual hosts not working anymore

Status
Not open for further replies.

stasJohn

Programmer
Joined
May 6, 2004
Messages
155
Location
US
I'm running a linux server for developing and testing websites on.
fedora core 2
apache 1.3

Its been running for weeks now without a problem. Last night I had to turn it off. I flipped it on this morning and when I tried accessing sites on it I was getting a "not found" error. When I attempted to restart apache, I got this error: "[error] Failed to resolve server name for 192.168.1.104 (check DNS) -- or specify an explicit ServerName"

Here's some more details about the server...
First, I don't actually own a domain. I use a dyndns.org name to point to my server. And I use virtual hosts.

exceprts from httpd.conf:
Code:
ServerName devserver
NameVirtualHost 192.168.1.104

<VirtualHost 192.168.1.104>
  DocumentRoot /usr/local/apache/htdocs/
  ServerAlias name.dynalias.com
</VirtualHost>
<VirtualHost 192.168.1.104>
  DocumentRoot /home/username/public_html/
  ServerName username
  ServerAlias username.name.dynalias.com
</VirtualHost>

Now, if I enter my dyndns name (name.dynalias.com) I can access the default page. If I access user accounts using "name.dynalias.com/~username", it also works. So basically, my virtual hosts have suddenly stopped working.

error log produces
Code:
[Thu May 12 12:10:37 2005] [error] Failed to resolve server name for 192.168.1.104 (check DNS) -- or specify an explicit ServerName
[Thu May 12 12:10:38 2005] [notice] Apache/1.3.33 (Unix) PHP/4.3.11 configured -- resuming normal operations
[Thu May 12 12:10:38 2005] [notice] Accept mutex: sysvsem (Default: sysvsem)



Any idea why my virtual hosts have given out.

Thanks in advance
 
stasJohn,

One possibility is that your internal LAN IP address may have changed.
Does 'ifconfig -a' show an IP address of 192.168.1.104 for your server?

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Does 'ifconfig -a' show an IP address of 192.168.1.104 for your server?

yes, it shows the correct ip.
 
Ok, adding ServerName to all my virtual host containers made the "Failed to resolve the server name..." error message to go away. But I still cannot access the subdomain virtual hosts.
 
stasJohn,

What error does your browser show when you attempt to access the subdomain virtual host?

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
sorry for the very late response Wishdiak, I was on vacation last week.

The browser error is a 404 I believe...
Code:
Address Not Found Error

username.name.dynalias.com could not be found. Please check the name and try again.

The address (URL) does not correspond to a known site and could not be loaded. This could be due to a misspelling in the address or because the site does not exist. If the address is known to be valid, or if the problem occurs for many sites, it may be an issue with your proxy service (if you use one) or the directory name service lookup. In such cases you should consult your system documentation, administrator or Internet Service Provider (ISP) as appropriate for further assistance.
 
Is it possible that my ISP is somehow blocking access to subdomains. I did have my cable modem replaced a couple of weeks ago.

(sorry if this is a dumb question, but my "networks" knowledge is pretty basic.)
 
welp, I've figured out the problem.

My virtual domains were set up like this...
Code:
<VirtualHost 192.168.1.104>
  DocumentRoot /home/username/public_html/
  ServerName username
  ServerAlias username.name.dynalias.com
</VirtualHost>
I changed the "ServerAlias" directive to the "ServerName" directive, so that I now have...
Code:
<VirtualHost 192.168.1.104>
  DocumentRoot /home/username/public_html/
  ServerName username.name.dynalias.com
</VirtualHost>

And now everything works. Wonderful. I just wish I knew what changed, because it worked the way it was before for almost 8 months now.
 
Wow this is annoying. Now the above is not working once again. Same exact problem. I did reset my cable modem the night before. Could that screw up the dns on my isp or something?
 
stasJohn,

It's possible that resetting your cable modem changed your IP address, or caused your router to misbehave.

See if you can ping a machine outside your network from your server. If you can't, reboot the router.

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Oh trust me I checked all that. The IP didn't change. The internet is fully accessible from every machine in the house, including the server. I've been browsing around the internet all morning before I noticed the subdomains on my server weren't working. Enter the ip address and the default server page comes up. Its only the subdomains.
 
Or if the ip did change, the runDNS utility running on my server properly updated dyndns.org to the new ip number a few minutes after the modem was reset.
 
Is this a dns issue? I don't think dns is running on my server.
 
stasJohn,

It does sound like a possible DNS problem. The DNS for your domain is not provided by a local DNS server, but rather by dyndns.org.

The quickest way I've found to check your current (routable) IP address is to go to Once you have this information, you should check to make sure that dyndns.org has the same IP address for your DNS records.

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
dyndns.org has the correct ip. The service runDNS running on my server ensures dyndns is updated whenever my ip changes. But I did double check and yeah, all is correct.
 
Welp, it suddenly started working again. You know its nice that its working, but its absolutely annoying not knowing what happened. I changed nothing, everything is the same.

Well, except for what I did just before it started working... in the httpd.conf file I changed LogLevel to "debug" and erase all the log files in the /logs/ folder.

Thanks for the help Wishdiak.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top