How to host a website on your computer

March 26, 2016 1:42 pm Published by 1 Comment

Once again my old netbook has proven itself to be useful by allowing me to turn it into a web server for hosting a basic html website from home and in this article I explain how I did it! It’s possible to install PHP and MySQL on your server as well, but for the sake of simplicity I will only go over the very basic instructions on how to set up an Apache web server on your old computer running Lubuntu which is a lightweight Linux distro perfect for older computers like the MSI Wind U100 netbook.

Installing Apache web server on Lubuntu

I chose Apache because it’s the most popular web server so it would make sense that it’s easy to use and secure enough for my project. To install Apache on your machine running Lubuntu simply open the command prompt (terminal) and type in the following command:

sudo apt-get install apache2

If you set a password when installing Lubuntu the first time then you are asked to enter it before proceeding. Additionally it asks for confirmation whether or not you want to install Apache so just type in Y for yes and press enter. From this point on the script will install everything automatically so sit back and watch it go for a minute or so. You know it’s done when you’re able to type commands again.

Checking if it works

Open up the web browser from your Lubuntu machine and in the URL bar type “localhost”, then press enter. You should see a page that looks something like this:

Default Apache2 web server html page

You can also access this page from another local machine by typing the internal IP address of the Lubuntu machine in the URL bar. In my case the IP was, but it’s probably different for you. You can see the internal IP by clicking the wireless connection icon at the bottom right next to the clock and clicking on Connection Information.

Change the html page

The default root directory for Apache is located in /var/www and the page you saw earlier is inside the /var/www/html folder. You can simply replace the index.html file to change your website.

If you are unable to delete or replace the index.html file due to insufficient permissions then try running the following commands in the terminal (ctrl + alt + T):

sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www

Note: If you are currently logged in with that username you need to log out and back in again for the settings to take effect.

Where to go from here

As I said earlier in this article, I have only covered the basics of setting up an Apache web server in order to host a website from your computer. If you are looking to publish that website on the world wide web then there are a couple of things left to consider. For example if you have a dynamic IP address you need to sign up with a third party service that lets the world know whenever your IP address changes.

Another logical next step would be to install PHP and MySQL on your home server if you are looking to host something a little more advanced than a plain html page (a WordPress blog, for example).

Additionally you should consider security. It’s alright if you want to host a website with pictures of your dog or maybe a personal diary, but if you have a more serious project on your hands then it would make more sense to invest in something more secure like DDOS protected dedicated servers.



In category:

This post was written by ynef