How to install Apache httpd 2.4 on Linux, macOS and Windows

Updated November 2026

On Linux, install Apache httpd from your distribution’s packages: one command gets you a working server that receives security updates with the rest of the system. Build from source only when you need something the packages do not offer. Windows users get ready-made builds from Apache Lounge, because the Apache project itself publishes only source code.

Before you start

The package name, service name and file locations depend on the system. Keep this table at hand; the rest of the guide uses these names.

Apache httpd 2.4 on common systems
SystemPackage / serviceMain config fileDefault web rootLogs
Debian, Ubuntuapache2/etc/apache2/apache2.conf/var/www/html/var/log/apache2/
RHEL, AlmaLinux, Rocky, Fedorahttpd/etc/httpd/conf/httpd.conf/var/www/html/var/log/httpd/
openSUSE, SLESapache2/etc/apache2/httpd.conf/srv/www/htdocs/var/log/apache2/
Alpine Linuxapache2/etc/apache2/httpd.conf/var/www/localhost/htdocsset in httpd.conf
macOS (Homebrew)httpd$(brew --prefix)/etc/httpd/httpd.conf$(brew --prefix)/var/wwwset in httpd.conf
Windows (Apache Lounge)service Apache2.4C:\Apache24\conf\httpd.confC:\Apache24\htdocsC:\Apache24\logs\
Source build—/usr/local/apache2/conf/httpd.conf/usr/local/apache2/htdocs/usr/local/apache2/logs/

A distribution package often carries a lower version number than the latest upstream release. That does not mean it is unsafe: Debian, Ubuntu, Red Hat and SUSE copy (“backport”) security fixes into the version they shipped. Ubuntu 24.04 LTS, for example, still calls its package 2.4.58, but it has received many security updates since. See Security for how to check your distribution’s fixes.

Debian and Ubuntu

sudo apt update
sudo apt install apache2

The package starts Apache straight away and enables it at boot. As of November 2026 the versions are 2.4.69 on Debian 13 “trixie”, 2.4.68 on Debian 12 “bookworm”, 2.4.66 on Ubuntu 26.04 LTS and 2.4.58 on Ubuntu 24.04 LTS (each with the distribution’s patches).

If you use the ufw firewall, the package ships ready-made profiles named “Apache” (port 80), “Apache Secure” (443) and “Apache Full” (both):

sudo ufw allow "Apache Full"

Debian splits the configuration into small files and gives you helper commands (a2enmod, a2ensite, a2enconf); the configuration guide explains them. On Debian the control program is called apache2ctl; apachectl is a link to it.

RHEL, AlmaLinux, Rocky Linux and Fedora

sudo dnf install httpd
sudo systemctl enable --now httpd
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --reload

Unlike Debian, Red Hat–family systems do not start the service on installation, so systemctl enable --now is needed. AlmaLinux and Rocky Linux are rebuilds of RHEL and use the same commands. Add port 443 the same way when you set up HTTPS.

Until you put an index page (such as index.html) in /var/www/html, the server answers with a test page and the status code 403. That is normal: the default welcome.conf shows the test page through an error document when the directory is empty.

SELinux. RHEL and Fedora run SELinux in enforcing mode. Files under /var/www get the right label automatically. If you serve files from somewhere else, label them, or Apache gets “Permission denied” even when the Unix permissions look right:

sudo dnf install policycoreutils-python-utils
sudo semanage fcontext -a -t httpd_sys_content_t "/srv/example.com(/.*)?"
sudo restorecon -Rv /srv/example.com/

openSUSE and SUSE Linux Enterprise

sudo zypper install apache2
sudo systemctl enable --now apache2
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload

SUSE also offers the “Web and LAMP Server” pattern in YaST. Virtual hosts go in /etc/apache2/vhosts.d/ as .conf files (there is a commented template, vhost.template), and SUSE ships its own a2enmod and a2dismod commands.

Alpine Linux

sudo apk add apache2 apache2-openrc
sudo rc-update add apache2
sudo rc-service apache2 start

Alpine 3.22, 3.23 and edge ship 2.4.69 (as of November 2026). Alpine keeps things small: mod_ssl is in the separate apache2-ssl package, the apachectl script is in apache2-ctl, and htpasswd is in apache2-utils. Extra configuration files go in /etc/apache2/conf.d/. This setup also suits containers; see Apache in Docker for the httpd image on Docker Hub.

macOS with Homebrew

brew install httpd
brew services start httpd

Homebrew’s build (2.4.69 as of November 2026) listens on port 8080, and on 8443 for HTTPS, so it can run without sudo. Open http://localhost:8080/ to test it. It uses the prefork MPM by default. Call it by its full path, such as $(brew --prefix)/bin/apachectl, so that you never run a different copy of httpd by mistake.

Windows

The Apache HTTP Server project releases only source code. Its Windows documentation sends you to third-party builds and names Apache Lounge (plus WampServer, a bundle with PHP and MySQL). As of November 2026, Apache Lounge offers httpd 2.4.69 built with Visual Studio 2026 (VS18), in 64-bit and 32-bit zip files dated 2 October 2026. ApacheHaus, the other well-known builder, stopped work in February 2023 and removed its old httpd downloads in 2024, so do not use old ApacheHaus builds.

  1. Install the latest Microsoft Visual C++ Redistributable for Visual Studio 2017–2026 (x64 for the 64-bit build). Apache Lounge links to it.
  2. Download the Win64 zip, check its SHA-256 checksum against the one published next to it, and unzip it so that you get C:\Apache24. The standard configuration expects that folder. If you use another one, change the ServerRoot path near the top of conf\httpd.conf.
  3. Open a Command Prompt as Administrator, test the configuration and install the service:
cd C:\Apache24\bin
httpd.exe -t
httpd.exe -k install
net start Apache2.4

The service is called Apache2.4 unless you give it another name with -n. By default it runs as the LocalSystem account. The httpd documentation suggests a separate account if the server needs network shares. If the service will not start, run httpd.exe in the console window: the real error message appears there.

Building from source

Build from source when you need a newer httpd than your system offers, special compile options, or a separate test install. You then have to watch for security releases and rebuild yourself. You need a C compiler, make, APR and APR-util (APR 1.7.6 and APR-util 1.6.6 are current as of November 2026), PCRE2, and OpenSSL headers if you want HTTPS.

# Debian/Ubuntu build dependencies
sudo apt install build-essential libapr1-dev libaprutil1-dev libpcre2-dev libssl-dev
# RHEL/Fedora: sudo dnf install gcc make apr-devel apr-util-devel pcre2-devel openssl-devel

curl -O https://dlcdn.apache.org/httpd/httpd-2.4.69.tar.gz
curl -O https://downloads.apache.org/httpd/httpd-2.4.69.tar.gz.sha512
sha512sum -c httpd-2.4.69.tar.gz.sha512
tar xzf httpd-2.4.69.tar.gz
cd httpd-2.4.69
./configure --prefix=/usr/local/apache2 --enable-ssl --enable-mods-shared=most
make
sudo make install
sudo /usr/local/apache2/bin/apachectl -k start

The checksum file has the same name as the tarball plus .sha512; for full protection, also check the PGP signature with the project’s KEYS file, as the download page explains. If you leave out --prefix, httpd installs to /usr/local/apache2. Modules are built as loadable modules (DSOs), and you switch them on or off with the LoadModule lines in conf/httpd.conf. To build against a newer APR than your system has, unpack APR and APR-util into srclib/apr and srclib/apr-util (no version numbers in the folder names) and add --with-included-apr. Running make install again for an upgrade does not overwrite your configuration files or documents. A source build has no systemd unit, so write one if the server must start at boot.

Start, stop, reload

On systemd systems use the service name from the table (apache2 or httpd):

sudo systemctl status apache2     # is it running?
sudo systemctl reload apache2     # re-read config, keep open connections
sudo systemctl restart apache2    # full restart (drops connections)
sudo systemctl stop apache2
sudo systemctl enable apache2     # start at boot

On Debian, Ubuntu and Red Hat systems, reload runs a graceful restart. Running children finish their current request before the new configuration takes over. A restart refuses to run when it finds a syntax error. Some other problems, such as a port that another program already uses, only show up once the server starts, and they can stop it. Test first, and reload only if the test passes:

sudo apachectl configtest && sudo systemctl reload apache2

Without systemd, apachectl -k start, -k graceful, -k stop and -k graceful-stop do the same jobs.

Check that it works

apachectl -v
curl -I http://localhost/

Use apache2ctl -v on Debian and Ubuntu and httpd -v on Alpine. The output looks like this:

Server version: Apache/2.4.69 (Debian)
Server built:   …

apachectl -V (capital V) adds the build settings, including the MPM and the compiled-in paths. curl -I should return an HTTP/1.1 200 OK line, or 403 on a fresh RHEL install as explained above. If the start fails, read the error log listed in the table. The two most common first-day messages are AH00558 (no ServerName set; harmless, fixed in configuration basics) and “Address already in use” (another program already has port 80). Troubleshooting errors covers both.

Common mistakes

Sources