How to start, stop, restart Apache Server on FreeBSD

To start, stop, or restart the Apache HTTP server on FreeBSD, you can use the apachectl script. Here are the basic commands:

  1. To start Apache:
    sudo /usr/local/sbin/apachectl start
  2. To stop Apache:
    sudo /usr/local/sbin/apachectl stop
  3. To restart Apache:
    sudo /usr/local/sbin/apachectl restart

You can also use the -k option to apachectl to control Apache’s behavior more precisely. For example:

  • To gracefully restart Apache (i.e. without dropping connections):
    sudo /usr/local/sbin/apachectl graceful
  • To stop Apache gracefully:
    sudo /usr/local/sbin/apachectl graceful-stop
  • To check the syntax of Apache’s configuration files:
    sudo /usr/local/sbin/apachectl configtest

Note that the location of the apachectl script may vary depending on your FreeBSD installation and the version of Apache you have installed. If you’re not sure where the script is located, you can try searching for it using the whereis command:

whereis apachectl

Once you know the location of the apachectl script, you can use it to start, stop, or restart the Apache HTTP server on FreeBSD.

Leave a Comment