Ubuntu Install Apache

Run the command below to install Apache web server in Ubuntu 20.04.

sudo apt update
sudo apt upgrade -y
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
Image for post
Image for post

< Back to all the stories I had written

Written by

A software engineer, a rock climbing, diving & rollerblading enthusiast, a husband, a father.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store