Apache HTTP Server, or simply Apache, is one of the oldest and most powerful open-source web servers on the planet. Developed and maintained by the Apache Software Foundation, it's been serving content across the web since 1995 β yes, that's longer than Google's been around.
Today, it still powers millions of websites, offering rock-solid stability, module-based architecture, and fine-grained control for hosting everything from a tiny portfolio site to enterprise-grade web services.
sudo apt update
sudo apt install apache2
sudo systemctl start apache2
sudo systemctl enable apache2
brew install httpd
sudo brew services start httpd
π Visit http://localhost and you'll see the βIt works!β page. Apache is alive!
/etc/apache2/ (Linux config directory)/var/www/html/ (default public web root)/etc/apache2/sites-available/ (virtual hosts)/etc/apache2/mods-available/ (modular configuration)Virtual Hosts allow Apache to serve multiple websites from a single server. You can route traffic based on domain, port, or IP address.
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
<Directory /var/www/example.com/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save this in /etc/apache2/sites-available/example.com.conf, then enable it:
sudo a2ensite example.com
sudo systemctl reload apache2
Apache is modular! Enable modules as needed:
sudo a2enmod rewritesudo a2enmod sslsudo a2enmod dirReload Apache after enabling modules:
sudo systemctl reload apache2
Apache allows directory-level overrides using .htaccess files. Great for enabling URL rewrites or
setting up authentication.
RewriteEngine On
RewriteRule ^about$ about.html
RewriteRule ^contact$ contact.html
Make sure your vHost allows overrides with AllowOverride All.
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
Generate a password file:
sudo apt install apache2-utils
htpasswd -c /etc/apache2/.htpasswd youruser
sudo apt install php libapache2-mod-php
sudo systemctl restart apache2
Now your index.php files will be parsed automatically!
Install Certbot to secure your domain with SSL:
sudo apt install certbot python3-certbot-apache
sudo certbot --apache
Follow prompts and voilΓ ! Free SSL in minutes.
mod_cache, mod_expiresmod_deflate for Gzip compressionKeepAlive, MaxClients in apache2.conf| Feature | Apache | NGINX |
|---|---|---|
| Architecture | Process-based | Event-driven |
| Flexibility | Highly modular | Limited modules |
| Performance (Static) | Good | Excellent |
| .htaccess support | Yes β | No β |
Apache might not be as βcoolβ as some newer options, but it's mature, insanely configurable, and still a solid pick for countless use cases. If you're working on shared hosting, running legacy PHP apps, or just love flexibility, Apache is your friend.
In a world full of web servers, Apache isn't going anywhere. It's a quiet giant β stable, strong, and surprisingly modern under the hood.
β Blog by Aelify (ML2AI.com)
π Documentation Index