Contents

Tutorial Video



Introduction

In this tutorial we will guide you to install Apache on Debian 8. Apache is a web server that is very popular in Linux operating systems.
 

Prerequisites

You will need:

  1. A VPS Tiger server, order at Pricing
  2. Getting Started with VPS Tiger Tutorial
  3. SSH with root access.

 

Update Packages

Make sure your server is fully up to date.

apt-get update

 

Install Apache

Install Apache web server using apt-get command.

apt-get install apache2

You will get output similar to:

...
Enabling module reqtimeout.
Setting up apache2-mpm-worker (2.2.22-13+deb7u12) ...
[ ok ] Starting web server: apache2.
Setting up apache2 (2.2.22-13+deb7u12) ...
Setting up ssl-cert (1.0.32+deb7u1) ...

 

Boot Configuration

Enable Apache to start on boot.

update-rc.d apache2 defaults

Start Apache.

service apache2 start

 

Accessing Web Page

Access web page by entering your public ip address at browser.

http://server_public_IP_address/

You will get default Apache page.
You can upload your web pages at following location:

/var/www/

 

Configure Virtual Hosts

To access your web page via domain name, you will need to create virtual host.

nano /etc/apache2/conf.d/myhost.conf

Add following lines and save the file using CTRL + X

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot /var/www/yourdomain.com/public_html/
</VirtualHost>

If you want to add another domain add VirtualHost block. It will look like that:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot /var/www/yourdomain.com/public_html/
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName newdomain.com
    ServerAlias www.newdomain.com
    DocumentRoot /var/www/newdomain.com/public_html/
</VirtualHost>

Create the directories referenced above.

sudo mkdir -p /var/www/yourdomain.com/public_html
sudo mkdir -p /var/www/newdomain.com/public_html

Restart Apache for the above changes to take effect.

service apache2 restart

 

Conclusion

Congratulations! You have just installed Apache on Debian 8.