Quest4 Apache on FreeBSD

Some notes from the things I ran into while trying to get Apache to run on FreeBSD.

Pre-Apache install note: These notes really take off after I finally got Apache installed. If you haven't gotten that far yet, I figured it out by Googling for keywords: FreeBSD, install, and Apache. Lots of info. Some helpful, some NOT.

1) After you install FreeBSD, for the love of god, set the system time and date. I didn't, and wasted many hours after my installation of FreeBSD, trying to install Apache. My problem was that on running "make install," it stopped with the error:

Configuration.tmpl is more recent than Configuration.apaci;
Make sure that Configuration.apaci is valid and, if it is, simply
'touch Configuration.apaci' and re-run ./Configure again.
*** Error code 1

I searched Google for many hours and saw many different reasons for this error. I tried to "touch Configuration.apaci" to no avail. I tried to install Apache manually...and finally broke down and downloaded the binaries. It was only after, and we are talking many wasted hours later, I tried to install Proftpd that it hit me. Short story, Proftpd also failed on install, but its creators were kind enough to mention to CHECK THE FREAKING SYSTEM DATE!!!

Note: command is date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" or

# date 050720113047

Here is how to break it down number by number:

01 - The Year: 05
03 - The Month: 07
28 - The Day : 20
20 - The Hour: 11
55 - The Minutes: 30
47 - The seconds: 47
(Time is 24 hour format, not 12 hours).

Some other time savers you can only learn the hard way:

These are the things minimum things to add to the /etc/rc.conf file to get Apache to run correctly (IP addresses are example only, and completely made up):

ifconfig_dc0="inet netmask"
ifconfig_dc0_alias0=" netmask"
route_dc0="add -net -netmask -gateway"

Note: dc0 is the device name for the nic card, but they vary, so yours may not be the same.

The things that I HAD to put in before I got Apache to run were:


If you don't call your computer a hostname, you will get this error in Apache:

Could not determine the server's fully qualified domain name, \
using for ServerName

(Note: setting hostname= in the /etc/rc.conf file worked for me in that Apache started. However, other sources say to set the domain name in the file /etc/hosts (e.g. add something like this myhostname).

I don't fully understand the "fully qualified" part of the hostname, either. All I know is that when I put something there, Apache quit giving me the error.

ifconfig_dc0_alias0=" netmask"

If you want to have Apache use an IP address different from the computer's main IP address, you HAVE to give your nic card a matching alias IP address. In retrospect, it makes sense, however, I wasted quite a bit of time on this.

Here is the kicker, and you would think any idiot would start here first...but I didn't. Why? Because I was in a hurry and didn't read everything. After you half-ass install Apache and then can't figure out why it won't are going to edit the file in /usr/local/etc/apache/httpd.conf. (For more info: google with keywords like freebsd, apache, and httpd.conf).

I don't know that I did this 100% correct, but I got Apache to start and work, without a "fully qualified domain name" by changing the lines:

Now if you notice what I did here, I told Apache to listen on the IP address that I assigned on the nic card as an alias IP address (see /etc/rc.conf: ifconfig_dc0_alias0=" netmask"). Until I configured it this way, Apache failed on startup.

After all this was done, I was able to open up a web browser and, over the Net, http to (again, numbers I pulled out of the air) and pull up the default Apache web page. I was way happy.

Again, I'm positive there may be better ways of doing this stuff, I'm just noting the things that I learned through trial and error that got Apache to work for me. Questions I have is if you can give your server a hostname of anything and it will work? Don't know.