How to Install Apache on Debian Linux 8.3 – Configure Apache Web Server on Debian

In This tutorial We are going to learn how to install and configure Apache Web Server on Debian Linux 8.3. After Installing Apache on Debian we will also look at how to Configure Apache Virtual Host to host multiple websites on single server.

Update apt source list

Before Install Apache on Debian update the apt source list using apt-get update command.

apt-get update

Install Apache2 using apt-get install

In Debian Linux, Apache HTTPD server provided by the apache2 package, which we can install using apt-get install command.

apt-get install apache2

Start Apache Web Server

Use systemctl command to start and restart the Apache server on Debian Linux 8.3

systemctl start apache2

Also set apache to start at system restart, using systemctl command.

systemctl enable apache2

start apache web server on debian Linux

In Debian Default document root for the apache web server is /var/www/html folder. If you want you can host a static your website right away by putting your html files into the /var/www/html folder.

How to Install Apache on Debian Linux 8.3

Create Apache Virtual Host Debian 8.3

Virtual host concept in Apache Web Server Allow us to host more than one website on the same web server.

To create a VirtualHost first we need to create a configuration file for our website inside the /etc/apache2/sites-available/ directory. The Configuration file should end with .conf extension. For example, if your site name is, then the configuration file should be something like example.conf.  .conf extension is mandatory.

touch /etc/apache2/sites-available/example.conf

Then You need to add your website name and document root to the Configuration file inside the VirtualHost directory as follows.

<VirtualHost *:80>



DocumentRoot /var/www/example

ErrorLog /var/log/apache2/

CustomLog  /var/log/apache2/ combined


Next, Create the Document root /var/www/example

mkdir -p /var/www/example

chgrp www-data /var/www/example/

chmod 755 /var/www/example/

After creating the Virtual Host you need to enable it using a2ensite command followed by the name of the configuration file.

a2ensite example.conf

Then, we need to restart the apache web server after enabling the site.

systemctl restart apache2

Now the domain can serve from the /var/www/example directory. This way you can host as many websites as you want on a single debian web server.

Summary : What we Learned

  • In This Debian Tutorial We learned How to Install And Configure Apache on debian Server.
  • We Also learned How to Configure Apache Virtual Host on Debian Linux to Host Multiple Websites.
submit to reddit