Install Apache 2 on Ubuntu 20.04


The webserver… Sure.
Let’s have it working in 2 minutes…

Install Apache 2

sudo apt install apache2

Check configuration

apache2ctl configtest

Let the traffic trough the firewall

sudo ufw allow in "Apache Full"

Enable some modules (here are some common examples for mod_expires, mod_http2, etc.)

sudo a2enmod expires
sudo a2enmod http2
sudo a2enmod ssl
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod deflate

Restart it

sudo systemctl restart apache2

With Apache HTTP Server installed, you can now proceed to create some Virtual Hosts:
Create a Virtual Host for Apache on Ubuntu

Most probably you will also want to install PHP after that. Here are the links for some short tutorials to install PHP 7.4 and PHP 8.0:
Install PHP 8 on Ubuntu 20.04
Install PHP 7 on Ubuntu 20.04

Leave a Reply

Your email address will not be published. Required fields are marked *