I'm using FreeBSD 8.3 and Apache 2.2. I didn't install Apache from ports, instead compiled it from source because I wanted to move the binary and configuration to a different path (I'm centering all of the major production daemons and their configurations in a single place). In any case, I based the /usr/local/etc/rc.d/apache22 file on one from a different server where it was installed from ports, I only modified the binary and config paths within.

I can manually execute it with /usr/local/etc/rc.d/apache22 start, however even with apache22_enable="YES" in /etc/rc.conf it fails to start. All permissions and ownership are identical to the other server where it works.

What am I missing and is there a way to debug this kind of thing?

  • 2
    I'm sure you're well intentioned an all, centering all the major daemons in a single place; but you're creating a major headache for the next admin who will expect a vanilla install and find nothing of the sort. – Chris S Jul 10 '12 at 4:41
  • 1
    The ports system allows you to override the default installation locations. I'm not going to give you any more than that, though, because as @ChrisS said, you're saving up for a bleak future for your successors by not following FreeBSD's long established and very sensible conventions. If you insist on doing it, you can read the docs to find out how. Let the ports system do as much for you as possible. That's what it's for. – D_Bye Jul 10 '12 at 11:50

If you run /usr/local/etc/rc.d/apache22 rcvar it will tell you the variable it's looking at, and what it's set to in rc.conf, but if it's starting correctly with start (as opposed to onestart or forcestart) it should start correctly at boot.

If that doesn't give you an immediate answer and solution it's probably easier if you forget about basing your scripts on another one (the Apache script has some extra complexity), and instead start at the beginning with this guide to practical rc.d scripting.
If you follow those instructions you will have to go out of your way to create a non-working script.
As a bonus you'll learn all about how the rc.d sequence works, and be better able to understand and troubleshoot it in the future.

  • There is also always the hack solution of copying/symlinking the apachectl script that comes with apache into /usr/local/etc/rc.d, or calling it from /etc/rc.local -- these options are generally considered less elegant than making a working rc.d-style script – voretaq7 Jul 10 '12 at 3:19
  • /usr/local/etc/rc.d/apache22 rcvar returns apache then apache22_enable="YES" as it should. Start does work, but it just doesn't start on boot. – Oksana Molotova Jul 10 '12 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.