How to set up Apache Virtual host on Ubuntu

How to set up Apache Virtual host on Ubuntu

Apache is Most popular and reliable web server to
serving  web content on the internet. In this guide we will help you to host your website easy and fast within five minute.

First, What is your Ubuntu Version ?

Is that a latest version ?

Never mind about your Ubuntu version. You can easily go with this tutorial.

STEP 1 : Create the directory / Folder

   sudo mkdir -p /var/www/

STEP 2 : Give the permission to the directory

  sudo chown -R $USER:$USER /var/www/

STEP 3 : Create a dummy index file in the directory

In here we create a simple index file. That helps to check whether website is working.This is my sample index.html

<title>Welcome to tips</title>
<h1>Success ! Now you can host your real website.</h1>

STEP 4 : Create a new virtual host file

  sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/

Open your new conf. file with root permission

sudo nano /etc/apache2/sites-available/

STEP 5 : Edit the file with new configurations

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

STEP 5 : Enable the new virtual host

  sudo a2ensite

STEP 6 : Restart your Apache

  sudo service apache2 restart

If you are using a DNS manager, configure your domain point to your server alias.Example : Cloudflare , Rackspace .

Comments are closed.