freescr
03-24-2004, 09:41 PM
I just got a new server and installed apache. I tried to start it up and get this error:
/usr/local/sbin/apachectl start: httpd could not be started
I check the httpd-error.log and this is what it says:
[Wed Mar 24 19:09:52 2004] [alert] mod_unique_id: unable to gethostbyname("")
My etc/hosts file looks like this:
::1 localhost. localhost
127.0.0.1 localhost. localhost
67.66.66.66 gower01 . gower01
67.66.66.66 gower01 . .
(fake ip address)
The hostname is set to gower01 in the rc.conf file.
The server is running FreeBSD 4.9 from SM if that helps.
Could someone please tell me what I'm doing wrong or at least point me in the right direction?
Thanks for your time
freescr
03-24-2004, 09:59 PM
Also, I don't know if this makes a difference but when I type the command hostname, nothing shows, it is just blank. Thanks for your time.
Cirrostratus
03-24-2004, 10:35 PM
Edit your /etc/rc.conf and set the 'hostname' field.
I.E. hostname="foo.barfoo.com"
See the /etc/defaults/rc.conf for an example. DO NOT EDIT THE DEFAULTS FILE.
After you get that fixed you should set the "ServerName" field in your httpd.conf. If your using a ports version of apache the file can be found at /usr/local/etc/apache/httpd.conf
Also See:
man hostname
Jeremy
rkuris
03-24-2004, 10:36 PM
Run "hostname (whatever)" as root.
Then see if it will start up. If so, then probably what is going on is the reverse lookup of the interface address (the "primary one") is not coming up with a hostname when looking in /etc/hosts. Do you have two NIC cards? Maybe that is causing the problem.
There is also an apache configuration settings somewhere to override the hostname (ServerName perhaps?).
freescr
03-24-2004, 10:59 PM
You're a genious. I did the command:
hostname localhost
and tried to start apache and it worked. Is there a way I can get it to start up the localhost every time like that? For some reason, its not doing it automatically.
Cirrostratus
03-24-2004, 11:03 PM
Yes edit your 'rc.conf' file like I said and the change will be set on the next reboot. What you did is only temp until you reboot.
Thanks
Jeremy
freescr
03-24-2004, 11:22 PM
For some reason in my rc.conf file there are 3 hostname entries in what appear to be 3 different sections:
hostname="gower01"
hostname="gower01 "
hostname="gower01 . "
Should I just change it to:
hostname="localhost"
hostname="localhost "
hostname="localhost . "
I'm confused why there are three separate entries like this. On the other boxes that I've had, there have always been just one.
Cirrostratus
03-24-2004, 11:24 PM
No you dont want to do that.
What is your full domain name for this server?
Cirrostratus
03-24-2004, 11:31 PM
Example.
If your domain name is gower01.mydomain.com
then your 'hostname' should be set to
hostname="gower01.mydomain.com"
this entry should also match what you have in your /etc/hosts file
Example
::1 localhost. localhost
127.0.0.1 localhost.mydomain.com
67.66.66.66 gower01.mydomain.com gower01
67.66.66.66 gower01.mydomain.com .
Thanks
Jeremy
freescr
03-24-2004, 11:41 PM
Thanks for your time LTADMIN. It worked like a charm.
Cirrostratus
03-24-2004, 11:46 PM
Not a problem.
You really should take a look at the FreeBSD handbook it has alot of step by step instructions for problems like this and other server administration tasks.
http://www.freebsd.org/handbook/