Saturday, March 29, 2008

How to setup your own web server at home

Why would you want to set up a server at your home when there are so many free web hosting services available? Simple, because it's fun! Besides, there is no better way to learn than to set up your own server. Setting up a web server is very easy, thanks to software packages like EasyPhp, Abyss Webserver, XAMPP etc. You don't need to have any knowledge about Apache, PHP or ASP to use them. Each software allows it be configured according to your needs but you can safely leave it to its default settings. I choose Abyss Webserver because it has a very user friendly GUI and is very easy to configure.

Before you get down to setting up a server, its better to test the upload speeds of your internet connection because the speed at which your visitors will be able to download from your server will depend upon the speed at which you will be able to upload. DSLreport is a good site to test the connection speed. If your upload speed is anything greater than or equal to 256 Kbps (or 32 KBps) it will do. If the speed is lower than that, don't worry, it will work too. But it will take longer time for the page to open. And if you have more than one visitor at the same time it could take even longer.

Tip: You should try to keep the size of your pages as small as possible to enable faster page loading. For this, upload all images on your website to an external server, i.e. any image sharing site.

Now lets get to the actual procedure. First download Abyss Webserver and install it. When you run the application it will start listening at port 80 which is the default port for all HTTP connection. Before you can start configuring the server, you have to create an Admin account for yourself. After you've created an account, login and you will be presented with this page.


abyss web server


Clicking on Configure (Hosts) will take you to this


abyss web server


As you can see there are tons of settings available. Each one of these options will take you to more settings for you to find tune your server. I will leave that for you to explore.

After you have installed and run the webserver, open your browser and type http://127.0.0.1. If you get the Abyss's default page you know that your server is up and running succesfully. Now all you have to do is replace the index.html file under \Abyss Web Server\htdocs\ with your own files.

Your website will now require a hostname so that others can access it. Since your home net connection is probably on a dynamic IP we will use a service which is known as dynamic DNS. No-IP is one which gives this service for free. Go to this site and register a hostname for yourself. Then download their client software. This software will monitor your IP address and immediately update their DNS server whenever your IP changes. So no matter how many times your IP address changes throughout the day, the DNS servers will always map your domain name with the current IP address.


no-ip DUC


We are almost done. If your DSL router is configured in the Pure Bridged mode than there is nothing else to be done. But if your router is not configured in the bridged mode and doesn't allow any service from the Internet to access your PC, you need to setup port forwarding. When you setup port forwarding the router will transfer all requests to your PC from the Internet to the port number you assign.

To setup port forwarding type http://192.168.1.1 (or http://192.168.0.1) in your browser to take you to the router's login page. Enter the username and password (usually both "admin" by default). Different routers have placed the port forwarding settings at different places. You will find it either under the NAT, or Virtual Server or simply Port Forwarding. In the port forward settings, do these.

# Enter the static IP address of your PC i.e. the Ethernet card's IP in the Private IP field.
# Set both Public and Private port as 80.
# Set Protocol as TCP and click Save.

If you have difficulties port forwarding than there are a lot of resources on Internet that will guide you through the process.

That's it!! Now you can test your site from another PC not sharing your internet connection. If everything is working right you should be able to open your site. You can also test whether your port 80 is visible from the outside world, which is essential in order to access your site, by going to http://canyouseeme.org and entering the required port number. Don't forget to open the port 80 in your Windows firewall, if its running.

Caution: Running a web server on your PC is risky because it opens up your PC to everybody on the Internet. Be sure to have an updated Anti Virus, a firewall and an up to date Windows.

10 comments:

  1. yeah i always wanted my own web server tnx... oh and yeah can people upload their stuff to my web and then display it on my web? plz help wih that too if you can. tnx again

    ReplyDelete
  2. Short, sweet & to the point. Love it, thanks so much!

    ReplyDelete
  3. Hi, thank you for sharing this helpful information. I was able to set up my own personal web server which works find on my computer but when I try to access from other computer on my network, it doesn't show the images and CSS won't work too.

    Here's my info:

    1. XAMP
    2. Wordpress
    3. Linksys router

    Do you have any idea on how to fix this?

    Thank you..

    ReplyDelete
  4. @Rayman Abiva, from what you say it looks like you are using incorrect paths to link to images and CSS on your website.

    Open the pages of your website in Notepad or any text editor and find out what paths you have used to call images and CSS files. If it shows something like "C:\My Documents\...." then these won't work on other computers. You have to use relative paths.

    Read more here.

    ReplyDelete
  5. Hello Sir, I am came on your website because i need your help, currently I am operating two websites and are hosting on Indian web server. But in my country (India) have not any good Hosting Service Provider. I know about godaddy and lots of more but they are huge costly and I can’t afford these types of hosting providers. I know internet very well, I know database integration, and I want to start my own Private Web Server using my Internet Service Provider (ISP) and PC. Do you think is it possible for me in small budget, I am seriously interested to know about how to create web server for my websites. If you have any good suggestions please reply me soon, thanks for reply in Advance.

    ReplyDelete
  6. @Sanjay, other than for fun, running a web server at home is impractical. And you can't do that on a small budget. If you can't afford a web host provider, you certainly can't afford to run a web server at home 24x7. Think about electricity cost, bandwidth cost (your ISP won't allow you to run a webserver on a home plan).

    And why do you need an Indian hosting provider? There are lots of cheap offshore webhosts.

    ReplyDelete
  7. can i put movies or music on the server ?? and for example how long 700MB would be downloading from my computer in my friends house than you

    ReplyDelete
  8. What kind of connection i should take to run the server all the time with good bandwidth.

    ReplyDelete
  9. An alternate to canyouseeme http://www.portcheckers.com scan ports or test port forwarding

    ReplyDelete