How to Convert Your Computer into a Web Server with Linux


In this article, we show how to convert your computer into a web server with linux.

So you don't have to have linux as your operating system in order to do this. If you have a Windows PC, windows now allows linux apps such as Ubuntu to be installed on your computer without you having it have linux as your operating system.

Any computer that has internet connection, which you have because you're viewing this page, can act as a web server with a few short steps.

A web server is software that can serve up web pages when requested from web users.

The only real requirements to building a web server is to have a constant, active internet connection and having web server software that can implement HTTP requests such as GET requests when a web user is requesting a web site that you are hosting.

One of the most popular web server softwares is Apache.

According to recent data, Apache is the second most popular web server software in the world after nginx.

So let's now go into our program.

So if you have a Linux operating system, open the command line interface. If you have a Windows operating system, open the linux app that you have downloaded, which can be Ubuntu, Kali, or any other distribution of linux.

So we need to install the Apache web server software in our linux operating system. This is the software which acts to operate our web server.

But before we install apache2 on the linux server, we first want to update and upgrade the server.

We do this through the following lines below.

Now we can install Apache.

The current version of Apache is Apache2. So we'll install the latest version of apache.

With the following line below run on a linux command line, we install the apache2 web server software.

So it is very simple and basic on how we can install the apache2 software on a linux operating system.

So we now have the apache software installed on our Linux OS.

After you have installed apache, in order to run apache, you must run the following command below.

Once apache is started, it should look something like what is seen below.

Starting apache web server in linux

The last thing you need to do is find the IP address of your computer.

This can be obtained by the following line shown below in the command line.

This returns the following.

Finding the IP address of your computer in linux

The IP address is the number after inet at the top. In this case, the IP address is

So what you want to do now is go to the web browser that you use and enter in this IP address.

You should see a page showing for the Apache web server.

Since I used Ubuntu, I received this web page when running Apache.

Running apache on a web server on local computer with linux

So congratulations, you now have a web server running on your local computer.

However, this page does not look like a website at all.

Let's improve it.

let's change the home page.

We'll just create a very basic home page but something that seems more like a website.

So we can do this by entering the following command into our linux command line.

Inside this file, you can add simple HTML such as what is shown below.

Now if you refresh the page, you should see the following web page shown below.

Creating a home web page with the apache web server with linux

So this is better and looks more like a web page even though there's absolutely no styling added to it, but you get the point.

Let's go one level further and add another directory to this website.

Let's say the website is a store.

Many websites have different directories for things such as Store, Contact, Blog, etc.

Let's create a directory for Store.

We do this with the line below.

So now we have a Store directory.

Next we need to create an index.html for this file directory.

Within this web, we place the following code shown below.

Now within your browser, you type in your IP address +/Store/

For me, that is,

This gives the following output shown below.

Creating a web page in a new directory with the apache web server with linux

So now you see that we now have a website with not only a home page but with another directory.

We're serving pages online.

If you want this web server to more official, you wouldn't serve web pages with IP address but with a name such as,, etc.

People aren't app to remember numbers or dots well.

So you would need to register your IP address with a domain name server. You could call the website anything such (any name that isn't taken).

Next, you would need to make sure that your web server is always up to serve the pages. Thus, normally machines used to run web servers are normally dedicated to this task and are always up. Next, you would need to make sure that you have constant internet connection so that the apache server can always serve web users pages that they want.

And this is the basics of running a web server from your own computer.

So this is how to convert your computer into a web server with linux.

Related Resources

How to Get the Current Working Directory in Linux

How to Create a New File in Linux

How to Retrieve the Contents of a File in Linux

How to Delete a File in Linux

How to Delete a Directory in Linux

How to List Hidden Files in Linux

How to Rename a File or Directory in Linux

How to Determine the File Type of a File in Linux

HTML Comment Box is loading comments...