Quick answer: Install Apache with sudo apt install apache2 on Ubuntu/Debian or sudo dnf install httpd on AlmaLinux/Rocky, enable it with systemctl enable --now, and open ports 80/443 in the firewall. The package is called apache2 on Debian family and httpd on RHEL family.

Overview

Apache HTTP Server is the classic, battle-tested web server: .htaccess support, a huge module ecosystem and compatibility with virtually every CMS and shared-hosting tutorial. Choose it when your application depends on .htaccess rules or Apache-specific modules; choose Nginx when raw efficiency at high concurrency matters most.

Before you start

  • A Linux server with root/sudo access (how to connect).
  • Port 80 free: sudo ss -tlnp | grep :80 — stop Nginx first if it is installed.

Step-by-step guide

  1. Install:
    # Ubuntu/Debian
    sudo apt update && sudo apt -y install apache2
    # AlmaLinux/Rocky
    sudo dnf -y install httpd
  2. Enable and start:
    # Debian family
    sudo systemctl enable --now apache2
    # RHEL family
    sudo systemctl enable --now httpd
  3. Open the firewall (same as for any web server): UFW — sudo ufw allow 80/tcp and 443/tcp; firewalld — add the http/https services and reload.
  4. Check http://YOUR_SERVER_IP — the default page confirms it works.
  5. On Debian family, manage sites and modules the Debian way:
    sudo a2ensite mysite.conf
    sudo a2enmod rewrite
    sudo apachectl configtest && sudo systemctl reload apache2

Common issues

  • .htaccess ignored: set AllowOverride All in the site's <Directory> block and enable mod_rewrite.
  • Port conflict with Nginx: run one of them on 80, or put Nginx in front as a reverse proxy.
  • Config test fails: apachectl configtest (or httpd -t) shows the offending line before you reload.

When to contact support

Application-level configuration is yours to manage on an unmanaged server; if the server itself is down or unreachable, open a ticket.

Frequently asked questions

Why is Apache called httpd on AlmaLinux and Rocky?

The RHEL family packages Apache under its daemon name httpd, while Debian and Ubuntu call the same software apache2. Commands and paths differ accordingly.

How do I enable mod_rewrite for pretty URLs?

On Debian-family systems run "a2enmod rewrite", set AllowOverride All in the site's Directory block, then reload Apache so .htaccess rewrite rules take effect.

Can Apache and Nginx run on the same server?

Yes, but not both on port 80. A common setup runs Nginx in front as a reverse proxy on ports 80/443 with Apache listening on an internal port such as 8080.

Related articles

Ready to get started? Order a VPS at Cloud2Y →

Was this answer helpful? 0 Users Found This Useful (0 Votes)