Install Apache HTTP Server 2.4 on Ubuntu 24.04 LTS

# Update package lists
sudo apt update

# Install Apache (provides 2.4.58 or latest in repos)
sudo apt install apache2

# (Recommended) Update all packages
sudo apt upgrade

Apache should start automatically after installation.

# Show version
apache2 -v
# or
apachectl -v

# Check service status
sudo systemctl status apache2

# Restart (if needed)
sudo systemctl restart apache2

# Enable on boot (usually already enabled)
sudo systemctl enable apache2

Expected output example: Server version: Apache/2.4.58 (Ubuntu)

Open your browser and visit:

  • http://localhost → if you're on the same machine
  • http://your-server-ip-address → from another computer

You should see the Apache2 Ubuntu Default Page.

sudo ufw allow 'Apache'
sudo ufw reload

Verify with: sudo ufw status

  • Web root (put your files here): /var/www/html/
  • Main config: /etc/apache2/apache2.conf
  • Enabled sites: /etc/apache2/sites-enabled/
  • Default site config: /etc/apache2/sites-available/000-default.conf

sudo apt install php libapache2-mod-php php-mysql
sudo systemctl restart apache2

Quick test: create /var/www/html/info.php with <?php phpinfo(); ?> and visit http://localhost/info.php

Generally not recommended for production servers because:

  • You lose Ubuntu's automatic security updates
  • More maintenance work

Alternatives (only if you really need it):

  • Add PPA: ondrej/apache2
  • Compile from source
Quality, Reliability & Service
Thank You For Visiting
Brooks Computing Systems - Jacksonville
Visit https://bcs.archman.us