How to Set Up a Linux Web Server


So you want to host your own website from your own home or maybe your office. This tutorial will show you how to set up a basic web server using Linux. For this tutorial I have used Linux Mint 9 but the steps work the same on any recent Linux distribution.

OK first thing to do is give your server a static IP address on your network. Once you have set the static IP address you need to download and install the software you will need. Open up a terminal and install the following packages:

apache2 php5-mysql libapache2-mod-php5 mysql-server

During the install process MySQL will ask you for a root password. Make this something complex but do not forget it !!! Once installed open up a web browser and type the server address into the address bar (eg and you will see the message IT WORKS! This means that you have a working web server. Now it is time to add some content to your server. All apache servers store their web data at / var / www but as default you can not write to this folder. Open up a terminal and type:

sudo nautilus

Enter your password when prompted. Navigate to / var and right click on www. Then go to properties. Add yourself as either the owner or group and give yourself "create and delete files folder access".

Next thing to do is to download some ftp software. Personally I recommend Filezilla. Open up a terminal and type:

sudo apt-get install filezilla

Once installed connect to your existing web server and transfer your files into / var / www.

Congratulations !! Your website is now hosted on your new server but it will not yet be visible from the internet. Most networks sit behind a router which acts as a firewall, so to make your website visible you will need to forward http packets from your router to your server by opening up port 80 and redirecting it to your servers new IP address. Port is a good starting point to understand port forwarding.

You will also need to speak to your ISP about getting a static IP address for your router. Without this you will not be able to access your site every time your IP address changes.

And that is it !! You now have a basic web server from which to host your own website.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.