These are Brian Schoenbaechler's ramblings, rants, and raves about his life trying to grow his Small Business.

Sunday, September 11, 2005

How to set up a personal home web server

How to set up a personal home web server

A web server is software that continuously runs on a computer and allows other computers to download documents from it. This text that you’re reading right travelled over a network connection from Lifehacker’s hosting web server to your browser. Web servers are usually loud, scary, headless machines in cold windowless rooms, but you can run one under your desk at home.

Why would you want to run a home web server? Maybe you want to download files on your home computer from anywhere. Like, say, your digital music collection. In this how-to, we’ll set up a home web server that lets anyone (with the right password!) connect to your computer and download your MP3’s from it, for a nice way to share your music collection with friends, or play a song from your home machine at the office for co-workers.

Please note: Running a server on your home computer is a risky undertaking, and before you start, make sure your computer has all the latest patches and security updates, and that you’ve done a thorough spyware and virus scan. This tutorial is for advanced users who feel comfortable editing textual configuration files and exposing port 80 on their home computer to the internet. As always, a strong firewall with explicit user-set rules is recommended. Still game? Carry on.

Let’s get started.

What you’ll need:


A Windows PC [1]
An always-on broadband (DSL or cable) internet connection

Step 1. Install Apache HTTP server. [2]

First and foremost, disable and stop any other firewall or server software you may have running, including Windows Firewall, Skype, Trillian or any other instant messaging applications. This is extremely important, and if it’s not done, can cause the server installation and startup to fail miserably. These programs and services can be started and used again as usual once we’re done setting up the web server.

Download Apache HTTP Server from here, using the link under “best available version” next to “Win32 Binary (MSI Installer).” Start the installation wizard. Accept the license agreement and use the default location for the Apache files, in C:\Program Files\Apache Group\Apache2. When you reach the screen prompting for server information, enter your own email address and homeip.net [3] as the domain information, like so:



Complete the installation wizard using the “Typical installation” setting.

When it’s done, open your web browser and go to http://localhost/. If the page you see reads, “If you can see this, it means that the installation of the Apache web server software on this system was successful,” you’re golden. [4]

Step 2. Configure Apache to share documents from the right folder.

Say you want to make your music collection downloadable using your new web server [5], and all your music files are located in C:\Gina\My Music. Using a plain text editor like Notepad, open the C:\Program Files\Apache Group\Apache2\conf\httpd.conf file. This is Apache’s configuration file, which looks long and scary, but most of the defaults will work just fine for us. We just have to change a few things.

In this httpd.conf file, comment out the line that starts with DocumentRoot and add another with your directory, like this:


#DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
DocumentRoot "C:/Gina/My Music"

Then, comment out the line that starts with


Last, about 20 lines below that
require valid-user


Make sure you replace C:\Gina\my_password_file in the text with your own password file created above. Save this new file IN YOUR WEB SERVER DOCUMENT ROOT (in this case, C:\Gina\My Music) and name it .htaccess. Don’t forget the dot in the beginning, before .htaccess. So, in this case, we’re saving the file as C:\Gina\My Music\ .htaccess.

Now, using your web browser, go to http://localhost/. You should be prompted to log in. Enter your username and password you set up in your password file. Rock!

Step 4. Congratulate yourself. You’ve got a home webserver running.

If you are NOT behind a firewall, you can access your web server from other computers by typing your computer’s IP address into a web browser’s address bar. If you’re not sure what your IP is, visit What Is My IP to find out. If your IP is 12.34.567.890, then type http://12.34.567.890 into a browser’s address bar. [7]

If you ARE behind a firewall (like a wireless router), you’ll need to open up port 80 on the firewall and forward it to your computer. This part is beyond the scope of this article, but will be covered in a future Lifehacker feature.

Enjoy your new home web server!

— Gina Trapani




FOOTNOTES:

[1] Sorry Mac folks, but OS X comes with a web server all set up, so this tutorial’s not for you. [back up]

[2] There are other web servers out there, but we’re going with Apache HTTP server because it’s free, stable, and my favorite. [back up]

[3] It doesn’t matter what domain you put here. I chose homeip.net because it’s descriptive, and one of DynDNS’s home domains. [back up]

[4] A common during-installation error with Apache reads, “Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down. Unable to open logs.” This means that some other server program (like Skype) is interfering with Apache. To figure out what program it is, open a command prompt and type:

netstat -a -oFind the PID (Process ID) of the program running on your local machine on port 80 (or http.) Then open the Windows Task Manager (Cntl-Alt-Del). In the View menu, choose Select Columns, and check off PID. Then match the PID to the running process to find out what server program is running, and stop the program. Then retry the Apache installation. [back up]

[5] There are tons of uses for your personal web server beyond a password-protected jukebox. Publish your blog at home, host a personal wiki, share video files and photos. Basically any file you want to publish as read-only is a good candidate. A home web server has the advantage over special server/client software because it only requires a web browser to connect to it. [back up]

[6] If Apache doesn’t start correctly, it’s because it can’t read the httpd.conf file, which means you probably had a typo in your changes. Check your changes very carefully, save and restart Apache to try again. [back up]

[7] Keep in mind that depending on your internet service provider, your computer’s IP address may change. There’s an easy way to set up a memorable name that doesn’t change, but that topic will be covered in an upcoming Lifehacker feature. [back up]

13 Comments:

Anonymous Anonymous said...

Hey this blog is not about ftp web hosting. Silly internet bringing me here :-) Funny I have been doing hours of research on ftp web hosting and it brought me to your blog on this post. The web plays funny games sometimes. Anyways, I was reading your blog Brian and I think it is really cool. Keep up the great work.
If you do not mind I will snag your blog and put it in my favorites. I read a ton of stuff on here that interested me. Keep blogging away :-)

3:01 PM

 
Anonymous Anonymous said...

Sad to say I just got back from a bowling tournament and decided to log in and do some websurfing. Brian I love your blog. I had some very good laughs. I am doing a paper on small business web hosting services and have been downloading information for the last hour. I don’t know how I came across this post but I am glad I did. It has set me back a little because I have spent the last hour reading your archives. If you don’t mind I would like to add you to my favorites so I can back again and read some more. Well I need to get back to small business web hosting services. I am almost finished with it. Great job.
p.s some very good points on your blog

6:40 AM

 
Anonymous Anonymous said...

Hey this blog is not about best web hosting company. Silly internet bringing me here :-) Funny I have been doing hours of research on best web hosting company and it brought me to your blog on this post. The web plays funny games sometimes. Anyways, I was reading your blog Brian and I think it is really cool. Keep up the great work.
If you do not mind I will snag your blog and put it in my favorites. I read a ton of stuff on here that interested me. Keep blogging away :-)

4:45 PM

 
Anonymous Anonymous said...

Hey this blog is not about commercial web hosting. Silly internet bringing me here :-) Funny I have been doing hours of research on commercial web hosting and it brought me to your blog on this post. The web plays funny games sometimes. Anyways, I was reading your blog Brian and I think it is really cool. Keep up the great work.
If you do not mind I will snag your blog and put it in my favorites. I read a ton of stuff on here that interested me. Keep blogging away :-)

7:06 AM

 
Anonymous Anonymous said...

Hey Brian. Very nice blog :0) I just got inside from washing and waxing my truck. It is my baby. Took me 2 hours though. So I settled down into my basement and started doing some web surfing. Anyways I am in the process of grabbing my masters degree and have spent the last 6 months researching best web hosting company. In the midst of my surfing I landed smack dab in the middle of your blog. I hope you do not think I am intruding but I must say it is great blog. Even though this post is way off base from best web hosting company I found myself cruising through your blog archives for the last half hour :0) You have some nice blogging friends. Anyways, I need to get back to my mission. I wrote don’t your url and feel free to visit me here at best web hosting company. I am so busy so I can only update my site monthly. Keep up the great work.

6:25 PM

 
Anonymous Anonymous said...

I love your blog Brian. How long has it been on-line? Reason I ask is I am doing a ton of work in the area of small business web hosting services and will probably end up starting a blog of my own. Funny how the internet brought me here when I was doing searches on small business web hosting services. Oh well, I am glad it did. Keep up the great blogging and I am sure I will visit this post again!!

3:48 PM

 
Anonymous Anonymous said...

All I can say is WOW Brian. The other half and I just got back from our friends house (well her friends house) and I needed a huge break. I am working on a project right now that is based on best web hosting company. I have literally been on-line for 2-3 hours doing research. Even though this post really isn’t on the same page as best web hosting company I am certainly glad I came across your blog. There are a ton of great view points on this blog. Well I think I can here the kids screaming in the background. I put you in my internet favorites and I will certainly come back and visit. If you want to take a peek at my site you can find me here at best web hosting company. I update my site very frequently. Again, great job blogging and I will be back again soon!

12:15 AM

 
Anonymous Anonymous said...

What up Brian! I just finished up a ten hour work day and decided to kick back and do some surfing. So I grabbed myself a drink and stumbled across your blog while doing some research on web space hosting for a upcoming project I am doing. Well even though this post isn’t what I was looking for I really enjoyed reading your blog. Your doing a great job and please keep up the good work. Lots of people do not keep their blogs up to date :0) There are some very interesting view points stated here. Anyways I am going to grab the bull by the horns and continue to plug away at web space hosting. I have already bookmarked your blog. You many want to visit me at web space hosting. You never know you might see something you like! Again great job.

5:32 PM

 
Anonymous Anonymous said...

Hey Brian. Very nice blog :0) I just got inside from washing and waxing my truck. It is my baby. Took me 2 hours though. So I settled down into my basement and started doing some web surfing. Anyways I am in the process of grabbing my masters degree and have spent the last 6 months researching small business web hosting services. In the midst of my surfing I landed smack dab in the middle of your blog. I hope you do not think I am intruding but I must say it is great blog. Even though this post is way off base from small business web hosting services I found myself cruising through your blog archives for the last half hour :0) You have some nice blogging friends. Anyways, I need to get back to my mission. I wrote don’t your url and feel free to visit me here at small business web hosting services. I am so busy so I can only update my site monthly. Keep up the great work.

4:05 PM

 
Anonymous Anonymous said...

I love your blog Brian. How long has it been on-line? Reason I ask is I am doing a ton of work in the area of best web hosting company and will probably end up starting a blog of my own. Funny how the internet brought me here when I was doing searches on best web hosting company. Oh well, I am glad it did. Keep up the great blogging and I am sure I will visit this post again!!

2:32 PM

 
Anonymous Anonymous said...

Hi Brian your blog is really great! Wow :-) As I was out blog surfing and surfing the web for detailed info on personal web site hosting I stumbled across your blog. Obviously my search landed me here and it is a little off subject compared to this post, but I am certainly glad I did come across your blog. Did I already tell you I like it! If you would not mind, I would like to add your link to my "favorites" page to come back and read again sometime. Should you ever need it, there's lots of information on this site about personal web site hosting. Again, great blog and keep up the great work!

6:14 AM

 
Anonymous Anonymous said...

Hi Brian, I was just blog surfing and found you! Wow, I really like this one.
It’s such a pleasure to read your post …. Interesting! I was over at another site

looking at inventory software

and they didn't go into as much detail as you, but nonetheless interesting.

4:23 PM

 
Anonymous Anonymous said...

Hey this blog is not about ecommerce software

I have been doing hours of research on "Accounting-Software" and it brought me to your blog on this post. Anyways, Brian I was reading your blog and I think it is really cool. It’s really a pleasure reading your posts! Keep up the great work.

Keep blogging away :-)

12:58 PM

 

Post a Comment

<< Home