Apache Web Server
How to Install Apache Web Server (Ubuntu/Debian)
Apache is one of the most widely-used open-source web servers, powering millions of websites worldwide. It’s commonly used to serve PHP applications, WordPress sites, and static content on Linux servers.
Follow these steps to install and configure Apache on Ubuntu/Debian:
Step 1: Install Apache
sudo apt-get install apache2 -y
This installs the Apache2 package. The -y flag automatically confirms the installation prompt.
Step 2: Enable the Rewrite Module
sudo a2enmod rewrite
mod_rewrite allows URL rewriting — essential for clean URLs and .htaccess support, which most CMS platforms (like WordPress) rely on.
Step 3: Restart Apache
sudo systemctl restart apache2
Restarting applies the module changes.
Step 4: Verify Apache Is Running
If the status shows “active (running),” Apache is working. You can also visit your server’s IP address in a browser — you should see Apache’s default “It works!” page.
Common issues:
If the install fails, run sudo apt update first
If port 80 is already in use, check with sudo lsof -i :80 — another service (like Nginx) might be using it