For the complete documentation index, see llms.txt. This page is also available as Markdown.

38.1 Apache Web Server

Apache HTTP Server is one of the most widely used web servers in the world, featuring a modular architecture that enhances website functionality through dynamically loaded extension modules. This section covers compilation and installation via Ports, as well as basic configuration.

Installing Apache

Install using Ports:

# cd /usr/ports/www/apache24/
# make install clean

Or install using the pkg package manager:

# pkg install apache24

After installation, view the package's documentation to understand the necessary configuration and precautions:

# pkg info -D apache24

Daemon

To have Apache start automatically at boot, configure it as an enabled service.

Set the Apache service to start at boot:

# service apache24 enable   # Set Apache HTTP Server 2.4 to start automatically at system boot

Starting Apache

After enabling the auto-start configuration, manually start the Apache service and check its running status.

Start the service:

Check the Apache HTTP Server 2.4 service status:

After the Apache service starts, verify that the web service is responding to requests correctly by accessing localhost or the corresponding IP address:

Apache FreeBSD

The following are the main file and directory paths for Apache on FreeBSD, for reference during configuration and maintenance.

Directory structure:

Notes:

  • The Apache configuration file is located at /usr/local/etc/apache24/httpd.conf

  • The Apache sample file is located at /usr/local/etc/apache24/httpd.conf.sample

  • The Apache website root directory is located at /usr/local/www/apache24/data/

References

  • The Apache Software Foundation. Apache HTTP Server Documentation[EB/OL]. [2026-04-14]. https://httpd.apache.org/docs/2.4/. Official Apache HTTP Server documentation, covering configuration directives, modules, and virtual hosts.

  • The Apache Software Foundation. Apache HTTP Server 2.4 Release Notes[EB/OL]. [2026-04-14]. https://httpd.apache.org/docs/2.4/new_features_2_4.html. New features and changes in Apache 2.4.

Last updated