Apache HTTP Server is one of the most widely used web servers in the world. Its modular architecture supports a huge range of functionality including URL rewriting, authentication, and SSL. This guide installs Apache on Ubuntu 26.04 LTS and configures the firewall.

Tested and valid on:

  • Ubuntu 26.04 LTS

Prerequisites

  • Ubuntu 26.04 LTS server
  • A user with sudo privileges
  • UFW enabled

Step 1 – Update and Install Apache

sudo apt update
sudo apt install apache2 -y

Step 2 – Allow Apache Through UFW

Allow port 80 and 443:

sudo ufw allow 'Apache Full'
sudo ufw status

Step 3 – Verify Apache is Running

sudo systemctl status apache2

You should see active (running).

Step 4 – Test the Default Page

Visit http://your_server_ip. You should see the Ubuntu/Apache default page. Or:

curl -I http://localhost

Step 5 – Key Apache Commands

sudo systemctl start apache2
sudo systemctl stop apache2
sudo systemctl restart apache2
sudo systemctl reload apache2
sudo apache2ctl configtest    # check config

Step 6 – Enable Useful Modules

Enable commonly needed modules:

sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod ssl
sudo systemctl restart apache2

Step 7 – Key File Locations

  • Config: /etc/apache2/apache2.conf
  • Virtual hosts: /etc/apache2/sites-available/
  • Web root: /var/www/html/
  • Logs: /var/log/apache2/

Conclusion

Apache is now running on your Ubuntu 26.04 LTS server. Proceed to configure virtual hosts for your domains, enable SSL with Let’s Encrypt, and install PHP for dynamic content.