How to set up your own web server

1 - I can do better 2 - Jury's out 3 - Pretty darn good 4 - Splendiferous 5 - Awesometastic by 3 people | Log in to rate

Ranked #7,401 in Tech & Geek, #163,179 overall

Quite a few people these days are getting themselves a little piece of web space to call their own.  This can be a bit overwhelming to some at first, and even cost a few dollars.  The good news is it's rather easy to set yourself up to have your own personal web server from the comfort of your own home, and save a bit of cash as well.  Of course there are a few downsides, which I'll discuss as well.

So, if you want to set up your own web server, read on!  I'll show you to to set up a web server that you run, as well as discuss some alternatives and downsides to this type of set up.

Overview 

Setting up your own web server is not for everyone. Personally, I'm a techie so this sort of stuff interests me. You might be the same way. Or, maybe you want to save a few dollars, or you want total control over your server configuration. Whatever the case, I'll be explaining how to set up your own web server for very little cost (or none if you already have a domain name registered).

In this article I'm going to go over a particular setup. This is by no means the only way to do it. If you find yourself really interested and want to learn a bit more, feel free to browse some of the books below for a much more in depth treatment of the material.

What You'll Need 

Ok, so now you're all ready to set up your own server. I'll run through an overview of what you need, and provide links to each one below.

For us to get started, you'll need a computer, web server software, a domain name, and an account at a DNS service, an internet connection, and a router (optional).

For the purposes of this guide, I'll be using Windows XP, apache (the web server), and a D-Link router. I'll give specific examples of how to set up using these pieces of equipment, but even if you want to use different software or hardware the basic ideas remain the same.

Apache 

Apache
You'll want to download the http server (top left of the page) You want the latest windows msi package. To get there look for the section that has the unix files, and click the other files link. You need to find a file that is a windows .msi installer. There are a number of mirrors that host the file, so you may have to browse around.
Windows .msi installer
The apache web server.

Setting It Up 

When you're done with this section, you will have your own running webserver.

You should have 3 things right now - A computer running windows XP, the apache http server downloaded, and an internet connection.

Now run the installer. Most of the stuff is pretty cut and dry, just click on through until you get to the image at the right. If you already have yourself a registered domain, you can enter it. You enter it as yourdomain.com on the first line, www.yourdomain.com on the second, and for now just put an existing email address for yourself. We're not going to worry about setting up an email server yet. Continue on and youll eventually finish it up.

Now, to verify that the installation went smoothly, open your browser and point to http://localhost. You should see a screen that confirms that apache was installed (it's pretty self explanatory).

Now, congratulate yourself for setting up your very own web server.

Setting your IP address 

Now we need to give your server's computer a static IP address. Go to your network connections and find your network adapters properties. Go to the internet protocalls properties and set your IP address to something like 192.168.0.110. Set your DNS server to your router (192.168.0.1 or similar). You can look below for some resources on playing with your network settings if you'd like a more in depth treatment of this. For now we're just getting it ready for the next step.

IP Information 

IP Configuration
More in depth information about changing and working with your IP address.

Configuring Your Router 

Now we need to set up your router. It is not absolutly required to have a router, but I would suggest it. I personally use a Belkin wireless router, so I'm using that when I describe how to set it up. I'll try to be a bit broad in my description so you won't have much trouble figuring out how to configure yours.

First, you'll need to go to your router configuration page. This is usually 192.168.0.1. You'll need to log on (directions to do this should be in your router instructions), and find where your router controls its port forwarding. In my case it's on the advanced tab under virtual server. There are 2 ports to forward - 80 and 25. Enter your servers IP address in the private IP field, the type is TCP, and enter 80 in the port field(s). Then do the same for port 25. Save your changes and exit.

Getting On The World Wide Web 

Now comes the final step. When we're done you'll be able to go to your domain address and it'll take you to your personal server's web site.

You'll want to go to www.zoneedit.com and sign up and enter your domain name. You'll also need the IP address your router presents to the web. Point your browser to www.whatismyip.com to get this.

On your main ZoneEdit page, click on IP Addresses. Enter your router's IP address (the one you just got) and click add. Make sure to jot down the nameservers it gives you, as you'll need them in just a second.

The last thing you need to do is go to whereever you registered your domain, and change the nameservers to the ones from your previous step. You can usually do this online from your account page, but you may need to call and ask them to change it for you.

Now, you'll probably have to wait about a day for those changes to take place. So, head to the bar, grab a bear, and congratulate yourself because you now have your very own web server.

Where to go from here? 

Now that you've got your server up and running, there are a number of more advanced things you can get started on.

You might want to check out running some server side scripts (SSI's) on your web page. For example PHP is a server side scripting language.

You could also set up a database on your server to store any information you have. Mysql has a free database you can try out which is well suited for this sort of thing.

If you're really feeling adventurous and happen to have an extra computer around you don't use, you can set it up to run as a dedicated server (that's all this computer is used for). This opens up quite a few options, including operating system, any server side scripts, and a database. Just check out the links and books for some ideas and guides, and have fun!

Advanced Material 

Mysql
Check this out for getting started with a server side database
PHP
PHP is a nice server side scripting language, and it's rather easy to use with mysql.
Unix Information
Great place to look around if you're interested in setting up a Unix box for your server.

Great Stuff on Amazon 

Run Your Own Web Server Using Linux & Apache

A bit more advanced, and also deals with using Linux instead of Windows

Amazon Price: $29.16 (as of 12/26/2009) Buy Now

Murach's SQL for SQL Server

A nice guide to getting yourself a database set up to use on your server

Amazon Price: (as of 12/26/2009) Buy Now

Apache Pocket Reference

Great reference for apache. This is not a beginners book, but something nice to have to look up commands.

Amazon Price: (as of 12/26/2009) Buy Now

PHP and MySQL Web Development (3rd Edition)

Great book for when you're ready to build a more advanced web site.

Amazon Price: (as of 12/26/2009) Buy Now

by striker98

I'm a software developer from Maryland.  I've been reading up on web development in my spare time (php and mysql currently) and figured I'd share... (more)

Explore related pages

Create a Lens!