Apache2 is the most popular Web Server Implementation for Ubuntu Server 14.04. In This Tutorial we are going to learn how to install Apache on Ubuntu Server 14.04. In Addition to installing Apache on Ubuntu Linux, we will also learn how to create and configure Apache Virtual Host and host a simple static website on Ubuntu Server.
Apache web server for Ubuntu Linux provides by the apache2 package. We can install Apache2 on Ubuntu using apt-get install command.
sudo apt-get update
sudo apt-get install apache2
Then start the Apache web server using service command.
sudo service apache2 start
Now if you type your server IP address on the web browser you should get the Ubuntu Apache2 default web page.
So now let’s see how to host a static website on Ubuntu Apache Server. For this tutorial I am going to use the domain name www.example.com. And I am going to host www.example.com in /var/www/example folder.
First, create the folder /var/www/example using the mkdir command.
sudo mkdir /var/www/example
Then we need to make apache group www-data as the group owner of the /var/www/example folder and also give write permission to the group.
sudo chgrp www-data /var/www/example/
sudo chmod g+rwX /var/www/example/
sudo chmod g+s /var/www/example/
We configured document root for the our domain name www.example.com, now we need to create the apache virtualhost for the www.example.con domain.
Ubuntu Apache Virtual Host Configuration file should be create inside the /var/www/site-availe directory using .cong extension.
touch /etc/apache2/sites-available/example.conf
Now open example.conf file we created, using a text editor and add the following virtual host configuration.
ServerName www.example.com
ServerAlias example.com
DocumentRoot /var/www/example/
ErrorLog /var/log/apache2/example.com.error
CustomLog /var/log/apache2/example.com.access combined
Now we need to enable the virtual host using a2ensite command. Then restart the apache server using service command.
sudo a2ensite example.conf
sudo service apache2 restart
Ok, now we have configured the apache virtual host for our domain name www.example.com. Now all we have to do is put content of the Website to /var/www/example folder and point www.example.com to our server IP address using DNS.
Just like that you can create as many virtual hosts as you want and host multiple website on your Ubuntu server.
In this tutorial learned how to install and configure a basic Web server on Ubuntu Linux 14.04 using Apache Web Server.
First, we Installed Apache on Ubuntu 14.04 using apt-get install command. Then we learned to configure Apache Virtual Host on Ubuntu Linux to host multiple Web sites.
The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…
Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…
Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…
Focal Fossa will reach the End of Standard Support in May 2025, also known as…
Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…
Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…