Helpful Information
 
 
Category: BSD Help
how do I get apache to start at boot up?

How do I get apache to start at bootup. All the documentation that I've read said to put a script in /usr/local/etc , but there is no usr/local/etc . Also, what is the script supposed to look like?

/usr/local/etc/rc.d/apache.sh

/usr/local/etc/rc.d will be searched on startup by default. Check /etc/defaults/rc.conf, you should see local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d".

So I'm supposed to create the directory /usr/local/etc , then create a rc.d file with the text apache.sh ? Am I missing something here? I did this, rebooted, and apache didn't start, I had to manually start it. Sorry for seeming so thickheaded, but I'm new to freebsd and trying to get a server up and running.

>> So I'm supposed to create the directory /usr/local/etc

No. If you installed Apache via packages (precompiled binary) or from the ports collection at /usr/ports/www/apache13, it will mkdir the /usr/local/etc and rc.d directories for you automatically. apache.sh will also be copied from /usr/ports/www/apache/files/apache.sh to /usr/local/etc/rc.d.

There is no /usr/local/etc directory, it does not exist........once I create it and the and the rc.d document, what will be on the rc.d document? Thank you for your help and patience with this newbie.

rc.d is a subdir under /usr/local/etc. If it doesn't already exists, mkdir it manually.

Then what goes into this rc.d directory?

Read this entire thread again. Whatever local scripts that need to startup automatically on boot.

What do I put in the script that goes into /usr/local/etc/rc.d ?
If I just put "/usr/local/apache/bin/apachectl start" will that make it start at bootup, and what do I name the file?

I start my Apache another way on boot up, but not as fancy as the rc.d way. in /etc/rc.local i have added /usr/local/apache/bin/apachectl start . it may not be the correct way but anyway it works.

>> What do I put in the script that goes into /usr/local/etc/rc.d ?

The script apache.sh can be found from /usr/ports/www/apache13/files/, I already mentioned this previously. So you can copy it to /usr/local/etc/rc.d/ and alter it to your liking.

>> If I just put "/usr/local/apache/bin/apachectl start" will that make it start at bootup

Yes if the script is executable. However, a proper boot script expects more than just start option. At the minimum, you need start and stop. Unless you don't want Apache to shutdown gracefully.

Further, you are on FreeBSD, and apachectl should never be resided in a non-standard location, which violates FreeBSD directory layout [hier(7)]. Further, apachectl script should never go into bin directory, it should be sbin instead, for security reasons.
What you should do now is to remove your existing Apache and reinstall it from ports. Setting PREFIX of /usr/local/apache is extremely bad and non-standard. If you want to become a real FreeBSD user, follow the standard.

Thanks for helping me out, I'll reinstall apache into the proper location.

Wilbo










privacy (GDPR)