May 12, 2021

How To Install the Apache Web Server on Ubuntu

The majority of the worlds’ website is hosted on apache web-server. It is the most powerful server with features like robust media support and extensive integration with other popular software

In this article, we will explain to you how to install an Apache web server on Ubuntu server. So let’s get started 🙂

Step #1 : Installing Apache web-Server

Before installing Apache web server update your local repository, since apache is already available on our repository by default, you just need to run the command as follows;-

sudo apt-get update

To Install apache2 package

sudo apt-get install apache2

video url

Step #2 : Check your Apache web-Server Status

sudo systemctl status apache2

Sample Output

Access the landing page for in your browser for confirmation


You will see the default apache2 landing page like this-

Step #3 Setup Virtual Host

By default apache2 directory is /var /www/html , if you want to host any website then go to that directory and save your projects there in order to host your project on the web

Open the following directory to make a new virtual host file at /etc/apache2/sites-available/

sudo vi /etc/apache2/sites-available/

Paste the following VirtualHost Configuration

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

Save and close the file you are almost done!

Enable the file with a2ensite:

sudo a2ensite

Disable the default site defined in 000-default.conf:

sudo a2dissite 000-default.conf 

Test for configuration errors:

sudo apache2ctl configtest 

You should see the following output:

Syntax OK

Restart Apache web server

sudo systemctl restart apache2

All done now apache will serve your domain!!

Vedant Singh

Linux System Administrator | Entrepreneur | Founder Techmion. I have started my career as a Linux system Administrator after that quit my job to start something new that excites me and started a Tech Company in order to provide the best technology to my clients. My Company website link: For Bulk, SMS-Marketing follows the link :

View all posts by Vedant Singh →

Leave a Reply

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