-   Linux - Server (
-   -   Apache2 under Ubuntu - Virtual Host error on restart (

MJWhiteDerm 09-23-2007 09:44 AM

Apache2 under Ubuntu - Virtual Host error on restart
Hello all.

I'm running Apache2 under Ubuntu 7.04, FeistyFawn. I am fortunate to have fiber optic right to the house, and have a range of fixed IP addresses. I tried running several different web pages under Suse 10.1, with different external IP addresses. Now I'm trying to make Apache2 work on a single server and my router points all external port-80 calls to one box, which is the Ubuntu box in question.

When I do a sudo /etc/init.d/apache2 restart command, the following is the result:

michael@carolyn-ubuntu:~$ sudo /etc/init.d/apache2 restart
* Forcing reload of apache 2.0 web server... [Sun Sep 23 08:20:02 2007] [error] (EAI 2)Name or service not known: Cannot resolve host name cthia --- ignoring!
[Sun Sep 23 08:20:02 2007] [error] (EAI 2)Name or service not known: Cannot resolve host name rationaldruids --- ignoring!
apache2: Could not determine the server's fully qualified domain name, using for ServerName
[Sun Sep 23 08:20:02 2007] [error] (EAI 2)Name or service not known: Cannot resolve host name cthia --- ignoring!
[Sun Sep 23 08:20:02 2007] [error] (EAI 2)Name or service not known: Cannot resolve host name rationaldruids --- ignoring!
apache2: Could not determine the server's fully qualified domain name, using for ServerName

Can anyone point me to which configuration file has a problem and what the nature of the problem may be?

In addition to here, my personal email is

In addition to running two boxes with Ubuntu 7.04, I'm also running a Xandros box and a Suse 10.1 box. I have played with RedHat 8.0 and Mandrake 8.1 before.


acid_kewpie 09-23-2007 10:10 AM

well you've apparently used references to local machine names that don't exist within the DNS your server has access to... how did you make these changes? you sound like you're not sure what underlying files contain this config.. did you use some gui tool to do things? what did you do? what are you trying to achieve? your httpd.conf would be a good start if you want to get a good implementation working, but in terms of the errors listed there, they are not in DNS. you probably could just get away with adding the hostnames to /etc/hosts for a small implementation.

MJWhiteDerm 09-23-2007 10:27 AM

more specifics
These are all directories on one machine.

Apache2 under unbuntu uses apache2.conf instead of httpd.conf .. and the latter file is kept merely for backwards compatibility.

Initially, I read Apache - The Definitive Guide, re: apache2 configuration, but the setup under ubuntu doesn't match the setup as written in the Guide. Then, the section on Apache in the Unbuntu Linux Bible and it sort of worked. That is, I could see a single web page from outside the firewall. But when I tried to add virtual host configuration files under sites-available, they would only be visible if I used or 105/rationaldruids or 105/primumnonnocere (first, do no harm -- I'm a physician). So, I asked other people for advice, including on the ubuntu forums, and someone suggested using webmin, which I downloaded. It screwed things up, so I de-installed apache2 and reinstalled it. Now, from the lan, I can see each of the web pages, but again, I have to enter in the local lan address then the directory name. When I do the apache2 restart, I see the text I copied before. So webmin did something and I'm trying to figure out what.

My goal is to have this particular box (one of 8 in the house) serve as a web server for several different web pages I'm playing with. Most are just hobbies. I have a couple of more serious ones that I manage on servers elsewhere. My design skills are pretty weak, but I'm learning.

I also manage or .org

So, do I need to run a DNS server? I don't think I had it running before I messed things up with webmin.



acid_kewpie 09-23-2007 10:38 AM

well i'm not sure where these hostnames that aren't being resolved are coming into the equation in the first place... as above, please post the actual config.

MJWhiteDerm 09-23-2007 10:51 AM

actual configuration
I think you mean the actual configuration files.

To be more specific, I have the following directories under /var/www :
michael@carolyn-ubuntu:/var/www$ ls
apache2-default cthia laxlinux primumnonnocere
apache2-default-modified-doesn't-work DermEducation MikhailBadenov rationaldruids

Within apache2-default, there is the usual "If you see this, Apache works" index.html ... and http://localhost calls that up.

There is an index page within each of the other directories, which is visible if I enter: http://localhost/cthia etc. From elsewhere on the lan, calls it up. should pull it up from outside. Likewise, should pull up the correct page. nslookup will show for and .107 for laxlinux. I've asked my provider to move them all to 105 to solve some problems I have with my current Cisco router.

This is the content of httpd.conf :
" # This is here for backwards compatability reasons and to support
# installing 3rd party modules directly via apxs2, rather than
# through the /etc/apache2/mods-{available,enabled} mechanism.
#LoadModule mod_placeholder /usr/lib/apache2/modules/ "

The default apache2.conf is lengthy. Do you need to see it?

Within /etc/apache2/sites-available/ there is a file for each website. The default file is:

"NameVirtualHost *
# This is the unmodified default file under /etc/apache2/sites-available
<VirtualHost *>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
RedirectMatch ^/$ /apache2-default/

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from ::1/128


end of cut and paste

I hope I'm giving you the information you are looking for. I'm not trying to be obtuse.



MJWhiteDerm 09-23-2007 11:02 AM

I asked a friend to check the sites from outside the firewall. shows "If you see this, it means the installation of the Apache web server software on this computer was successful. You may now add content to this directory and replace this page." shows the intended page ... (despite the strange warning message). /laxlinux and /primumnonnocere and /rationaldruids show nothing .... so I have something screwed up in the virtual hosting files, I think.

MJWhiteDerm 09-23-2007 12:13 PM

Problem semi-fixed
Webmin had created some files within /etc/apache2/sites-enabled which had a name and no content. Once those were removed, some of the problems have now gone away.

I still get the following on apache2 restart:
" * Forcing reload of apache 2.0 web server... apache2: Could not determine the server's fully qualified domain name, using for ServerName
apache2: Could not determine the server's fully qualified domain name, using for ServerName "

Any idea in what config file the problem might be hiding?


acid_kewpie 09-23-2007 01:25 PM

well that's just a harmless warning, not a problem. it's down to the machine not being able to find an fqdn for itself, if you run "hostname -f" you'll probaly only get "localhost" or "dave" or whatever your machine is called, not "" which would be an fqdn. if you define your hostname and a domain name correctly that will go away.

MJWhiteDerm 09-23-2007 01:30 PM

Problem Fixed
I found the answer in another thread, and just implemented it a few minutes ago. This is what I posted there:

As described above, I put in


as an uncommented line, in the top of apache2.conf

Now, when I force reboot apache2, I get:

michael@carolyn-ubuntu:/etc/apache2/sites-available$ sudo /etc/init.d/apache2 restart
* Forcing reload of apache 2.0 web server... [ ok ]

So, the solution, as suggested, works fine.

This is NOT covered in the Ubuntu Linux Bible, or in The Official Unbuntu Linux book.


Thanks, again.


acid_kewpie 09-23-2007 03:02 PM

well yes you can manually force it, always nicer to have a technically correct solution really... that's nothing to do with Ubuntu though, so i wouldn't think about blaming their documentation for a subtlety of an unrelated package they have no control over.

MJWhiteDerm 09-23-2007 08:36 PM

Ubuntu vs other versions
Actually, I wasn't meaning to assign "blame" ... not a word I like to use.
I think it does reflect a slightly different implemntation of apache2 under ubuntu than the version I downloaded (on another computer) directly from ... in that there are different configuration files. Since the stuff I read didn't mention the issues I discovered, either it isn't there, or I haven't yet read the right stuff. It's probably the latter case.

At any rate, it's nice to find part of the solutions. I'm still working on the rest. Another voyage of discovery. ;-)


All times are GMT -5. The time now is 05:22 AM.