Run the command below to install Apache web server in Ubuntu 20.04.
sudo apt update
sudo apt install apache2 -y
Once installation completed, it is best to change the owner of the apache web server root folder to www-data.
cd /var
sudo chown -R www-data: /var/www
sudo chmod -R 775 /var/www
Assuming you are using the default user “ubuntu”, you will need to add yourself into “www-data” group. You’ll need to logout and login again to get the updated permission.
sudo adduser ubuntu www-data
To check if the installation was successful, run the following command. HTTP status 200 means it is successful.
curl -Is http://localhost