Create a Web server with Linux + Apache

Sharing is caring!

With my previous Post I showed you how to install XAMMP on windows and start your own web server.Today I will show you to install apache on linux and create a web server with linux distros

First choose your Linux Distro

In this step you can chose your favorite linux distro ex:-ubuntu,debian,linux mint,kubuntu anything you want.I am using ubuntu 14.X as my preference.For this setup I’m using vmware to virtualise ubuntu.From this post installation process of ubuntu and vmware will not be covered.

Install Apache

open up your terminal type following commands:-

[email protected]:~$ sudo apt-get update “this command will update installation database”

[email protected]:~$ sudo apt-get install apache2 “this will install apache server”

[email protected]:~$ sudo service apache2 start “starting apache services and output will be as follow”

* Starting web server apache2

Locate html Directory

Html directory is the place that contains web files and folders.This html folder is located in /var/www.

you can access that folder by CLI or GUI and i will demonstrate how to access it by CLI and GUI.

[email protected]:~$ cd /var/www/html/ “this command direct you to the html folder”

or by GUI Files>computer>var>www>html

After accessing html folder you will see a file call index.html and it is the web server’s index file.When we enter the ip address or the domain name of the web server it will direct us to this index.html file.So let’s see what will happen when we browse for server’s ip address.

In this setup my server is located on a virtual machine with the ip address You can find your ip address of your linux machine by typing ifconfig in the terminal.

[email protected]:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:83:f0:70
inet addr: Bcast: Mask:
inet6 addr: fe80::20c:29ff:fe83:f070/64 Scope:Link
RX packets:6256 errors:0 dropped:0 overruns:0 frame:0
TX packets:2151 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4042115 (4.0 MB) TX bytes:205327 (205.3 KB)

lo Link encap:Local Loopback
inet addr: Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:233 errors:0 dropped:0 overruns:0 frame:0
TX packets:233 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:29495 (29.4 KB) TX bytes:29495 (29.4 KB)

by the blue color you can see the Ip address configurations of my server.

So type that ip address in any computer’s web browser that connected to that virtual machine (Virtual machine,server computer and the client should be on the same network)

It will display default apache ubuntu page.

So You can replace this file with your own set of html or css files.

Leave a Reply

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