Docs / Web Servers / How to Install Apache on Ubuntu

How to Install Apache on Ubuntu

By Admin · Feb 25, 2026 · Updated Apr 24, 2026 · 112 views · 1 min read

Apache (httpd) is the most widely used web server in the world.

Install

apt update
apt install apache2 -y

Start and Enable

systemctl start apache2
systemctl enable apache2

Verify

Visit http://YOUR_IP_ADDRESS in your browser. You should see the Apache default page.

Firewall

ufw allow "Apache Full"

Key Files

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

Useful Commands

apachectl configtest  # Test configuration
a2ensite mysite       # Enable a site
a2dissite mysite      # Disable a site
a2enmod rewrite       # Enable a module

Was this article helpful?