Starting and Stopping the Apache Server

As mentioned previously, the Apache server will automatically start each time you boot your system because the installation process installed a startup script in /usr/local/etc/rc.d. However, if you want to start the server manually at any time, you can use the apachectl program. For example,

#apachectl start
/usr/local/sbin/apachectl start: httpd started

The apachectl program can also be used to stop the server, and it is the easiest and best way to do this. For example,

#apachectl stop
/usr/local/sbin/apachectl stop: httpd stopped

If you want to restart the server, apachectl also has a command to do this rather than having to issue two commands:

 #apachectl restart /usr/local/sbin/apachectl restart: ...

Get Sams Teach Yourself FreeBSD® in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.