Host Your Own Website Tutorial

My roommate asked me to create a website for his upcoming wedding. Well, I decided it would be a good opportunity to attempt to host my own website. I didn’t know where to begin, but I knew what I had. I had an extra computer that had a 2.4 GHz processor, 512MB RAM, and a 160 GB hard drive running Windows XP Professional SP2. Now, you don’t need two computers to do this, but I had the luxury.

There is a little bit of leg work, but I promise that you will learn a ton; and it will be a very rewarding experience.

What Needs To Be Accomplished

Here is a list of items that needed to be taken care of in the scope of this project.

  1. Set up Apache, PHP, MySQL (my native design environment).
  2. Get a domain name and point it toward my box.
  3. I also need to configure FTP to do remote changes.
  4. Set-up e-mail.

Setting Up the Server Environment

WAMPI found a good tutorial at Lifehacker, but I need some additional information. To set up my Apache, PHP, and MySQL I needed a WAMP (WindowsApacheMySQLPHP). I tried many, but I found that WAMP5 was by far the easiest to use. While packages like XAMPP have more “stuff” I could never get it to work.

Go download WAMP5 and run the install. You can choose where to install it, but I would suggest on our C: (or maybe partition a drive just for this). You should then go to http://localhost/, and you should see the WAMP home page.

Here is where you should pause and create all of your content. Create a directory under [WAMP Path]/www/, and that is where you can create your application.

Configuring Your Router

Now that your application is ready to go online it’s time to get a domain name! First, we need to configure your router for port forwarding or else no one will get to it.

I use a Linksys router, but you can Google how to port forward on your router and firmware. I went to my router’s admin section which for Linksys was http://192.168.1.1/. I then went to “Applications & Gaming” and put in the following values for both HTTP and FTP.

LinksysThe HTTP box is from port 80 to 80, and I assigned it the IP of the computer I want to forward to (to find your IP go to Start — Run — Type “cmd” (no quotes) — Enter — Type “ipconfig /all”). I also put in the values for FTP which is from port 21 to 21. Remember to check the “Enable” checkbox for both settings and save your changes.

Getting Your Personalized Domain Name

I would suggest going over to DynDNS to grab a domain name. You can get a free forwarding address, but if you want your own domain name you’ll have to pay for it (it’s worth it).

DynDNSCreate an account, and go to Services — Custom DNS. Go through their wizard to purchase your domain name. After your purchase goes through then we’ll need to point your domain name towards your local computer. Go to Services — My Zones and click on your domain name. When you get the options dialog then enter your external IP (get it the same way you get your local IP). If you’ve set your IP to be static or dynamic then choose accordingly (there is no reason to not use a dynamic IP, because DynDNS has an application to dynamically update your settings which I’ll show you).

Be sure to make sure that “Put Online” is selected in your WAMP menu (image above). After a few hours it will resolve, and you will see your website on the WWW! If you selected a dynamic IP then go grab the free IP update client for DynDNS and configure it.

Oh wait, there is one more important step! We need to add an alias on your Apache server to tell the server where to forward requests. Get the WAMP menu (right click on the taskbar icon), and go to Config Files — httpd.conf. This is where we will add an alias for your new domain. (I should tell you that you can get a GUI editor similar to IIS for Apache, but it is shareware.)

Scroll to the bottom to where you see the Virtual Host example. You will add the following information. This tells the server to listen on port 80 for requests made with a certain domain name, and when that condition is true it forwards it to a local directory on your server.

ServerName www.yourdomainname.com
DocumentRoot [WAMP directory]\www\yourprojectfolder

FTP and E-mail

You’re doing good! Hang in there! You now have a working domain name, but you’ll want to add FTP capability and maybe e-mail as well. For the FTP simply download the FileZilla Server. In there you can create users and assign appropriate permissions.

As for e-mail, instead of trying to set up your own POP/SMTP server why not get Google to do it for you? Google has free apps for your domain that you can utilize. Simply sign up for a free account, and configure the Gmail section. There is a tutorial in there where you’ll have to add MX records in your DynDNS configuration panel, but it’s painless. Now you can set up accounts that have 2GB of storage and use the Gmail interface!

You're Done!

Congrats! You are done! For only $40 you have your own server, personal domain, e-mail, and FTP! If you have questions be sure to provide plenty of information in the comments, and I’ll attempt to steer you straight.

45 Responses

  1. Dan February 5, 2007 / 5:09 pm

    great tut man, but what if you ISP (COX Comm. in my case) blocks common ports like (80,8080 etc)? unless you pay for business plan, which is way more then residental plans..

  2. Chris Poteet February 5, 2007 / 5:35 pm

    Hi Dan! You can use DynDNS’ WebHop service to accomplish what you need. Let me know if you need more help.

  3. Dan February 5, 2007 / 9:35 pm

    hey Chis.. i just signed up for that account, how would i go about setting everything up? I have static dns set up that points IP to my box, what about port or anything else?

    thanks in advance

  4. Dan February 5, 2007 / 9:38 pm

    oh, and i also have my own paid domain name with hosting server + another domain name (that i wanted to host from my box).. hope that helps

  5. Colin February 6, 2007 / 5:35 am

    This is excellent. Just what I needed in order to test my web designs. I’ve been delaying it because I did not want to go through the hassle and expense of renewing my hosting account.

    :)

  6. Dan February 6, 2007 / 9:52 pm

    i didn’t see this redirect option, awesome it works now with their subdomain.. can you help me out how would i use my own domain name.. i have one but with another company(dotster.com) that i prepaid for 2 years.. can i use it?
    ps. i don’t have forwarding option with dotster.com

  7. Dan February 8, 2007 / 3:59 pm

    Hey Chris.. i got it all up and running, appriciate your help man, thanks again

  8. [ZoDiaC] February 19, 2007 / 3:54 am

    thanks man great tutorial …

  9. leo June 15, 2007 / 2:29 am

    what does it mean when the log file says:
    [error] [client 192.168.1.1] client denied by server configuration c:/(my site)

  10. leo June 15, 2007 / 11:07 am

    just to add a little more info… when I try to access the page a get an 403 error in my webbrowser and the:
    “[error] [client 192.168.1.1] client denied by server configuration c:/(my site)” in my errorlog
    I’m running a router linksys and from what I gather I did sucessfully enable ports 21 and 80 so it can be forward to my pc.
    I’m running the demo from ApacheConf and I set it up just like in their video… when I click “test configuration” (virtual host) I get: Syntax OK press any key to continue

    I also tried to setup at DynDNS
    Hostname Redirected: (my WebHop site ).dontexist.org
    Redirect URL: http://(my Dynamic DNS site).gotdns.com/
    Cloak Active: N
    Cloak Title:

    (I never saw any place that would talk about redirecting ports though…)

    leo

  11. Chris Poteet June 15, 2007 / 1:23 pm

    @Leo: I am out of town right now, but I get back on Sun night. I’ll look more into your issue then.

  12. leo June 15, 2007 / 2:00 pm

    Thanks Chris, I really appresiate!

  13. leo June 16, 2007 / 1:46 am

    more tests
    I disconected my router and…
    client denied by server configuration: C:/wamp/www/
    [Fri Jun 15 21:00:17 2007] [error] [client xx.xxx.xxx.xxx] client denied by server configuration: C:/wamp/www/
    [Fri Jun 15 21:42:04 2007] [notice] Apache/2.2.4 (Win32) PHP/5.2.3 configured — resuming normal operations
    [Fri Jun 15 21:42:04 2007] [notice] Server built: Jan 9 2007 23:17:20
    [Fri Jun 15 21:42:04 2007] [notice] Parent: Created child process 4024
    [Fri Jun 15 21:42:04 2007] [notice] Child 4024: Child process is running
    [Fri Jun 15 21:42:04 2007] [notice] Child 4024: Acquired the start mutex.
    [Fri Jun 15 21:42:04 2007] [notice] Child 4024: Starting 250 worker threads.
    [Fri Jun 15 21:42:04 2007] [notice] Child 4024: Starting thread to listen on port 80.
    [Fri Jun 15 21:42:06 2007] [error] [client xx.xx.xx.xx] client denied by server configuration: C:/wamp/www/

  14. Chris Poteet June 17, 2007 / 11:11 pm

    Do you have DynDNS going to your external IP like I mentioned above? Where are you getting these error messages from?

  15. leo June 18, 2007 / 10:08 pm

    when I go to my account in DynDNS it shows: that:
    IP in Database/DNS = my external IP address… so my guess is yes.
    I also tried to enter to the site using my external IP in my browser and it says error 403 (You are not authorized to view this page)

    I’m getting my error message from the error.log

    I’m connecting from “Comcast cable”

  16. Chris Poteet June 19, 2007 / 7:25 pm

    For future readers: ensure that you have all firewalls turned off (i.e. the Windows one). The router has one by default so your system won’t be left vulnerable.

    If you’re getting “forbidden” errors then try this tutorial.

  17. Leo June 20, 2007 / 1:51 am

    Thanks Chris that tutorial save my life :)

    leo

  18. guitardude February 21, 2008 / 6:05 am

    about turning off Window’s Firewall… can i just open the 80 and 21 on the PC’s firewall. I would really like to leave it on. I hate the annoying warnings about the firewall being disabled (call me stubborn, but i dont want to disable the warnings either because i think they are a good thing at times). Great tutorial too. apache seemed a little too confusing to me at first but then i found this and now I am pretty confident. I haven’t set it up yet cause i need a little time, but i will soon. thanks in advance for any help.

  19. Chris Poteet February 21, 2008 / 2:25 pm

    @guitardude: Theoretically, yes that should work, but with Windows it’s always a guess.

  20. guitardude February 21, 2008 / 4:51 pm

    Thanks. I installed everything, but when i go to the phpMyAdmin page, i get the following message at the bottom of the page:
    Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole.
    I tried setting up a password on the Privileges page in phpMyAdmin, but then it started blocking me from accessing it. I couldnt get fix it so i uninstalled, then reinstalled. How should i fix the problem it is talking about?

  21. Chris Poteet February 22, 2008 / 1:35 am

    @guitardude: I never saw that until you pointed it out. Just be sure that any access you do with your database you do through a MySQL user account.

  22. guitardude February 22, 2008 / 2:42 am

    I am not really gonna be doing any database stuff, at least i dont think so. I just want to make a website that has some info about computer building and repair that i want to start doing. Will this pose any security problems to my computer?

  23. Chris Poteet February 22, 2008 / 5:16 am

    You should be fine, but be sure to only allow port forwarding for port 80.

  24. guitardude February 23, 2008 / 6:45 pm

    Thanks again. You have been a great help.

  25. charlie hoover April 28, 2008 / 5:32 am

    i have done everything you said.

    i am using linksys wrt54gx

    and comcast modem

    the dyndns uri is just getting me to my reuters login which is not good what is up? anyhelp would be greatly apreciated.

    thanks charlie

  26. Chris Poteet April 28, 2008 / 12:29 pm

    @Charlie: Did you do the port forwarding step?

  27. James May 22, 2008 / 6:35 pm

    I got my domain as godaddy, when i try and forward it to my dns service address which is psyion.ath.cx it tells me tehre is an error.

    any ideas?

  28. Chris Poteet May 22, 2008 / 9:53 pm

    @James: First I need to know what error you’re receiving.

  29. w barnard June 6, 2008 / 2:50 pm

    hi i have wamp running on my computer i am using no-ip with the server i have a website with a domain name how do i point my domain name at the wamp server so the site can be seen on the web thanks william

  30. John December 13, 2008 / 8:21 pm

    Just a note to let you know this tutorial is still being used, and there are a lot of grateful people. Thank you for sharing!

  31. labeeb May 26, 2009 / 8:07 am

    You rock dude. Thanks.

  32. Gmy77 March 13, 2011 / 4:33 am

    Thanks very usefull !!!

  33. Mians December 29, 2011 / 11:10 pm

    This is excellent. Thanks. I installed everything, good tutorial very useful steps . Please post more information thanks.

  34. Ajit February 27, 2012 / 1:56 am

    Hi Chirs,
    Great tutorial which helps a lot.I have installed the WAMP server and created an alias named “example” in it which points the a directory “c:/wamp/www/example”.I have written a simple html page named index which opens when I type in “http://localhost/example/” in my adress bar of the browser.Now when i rename it to same other file say example it does nt open.Can you tell me why is it so?I am just getting my hands dirty in web technologies.All help is appreciated.

    Thanks,
    Ajit

  35. Graham May 26, 2012 / 9:31 pm

    Thanks for your help! I was trying to get this to work, and was unable to until I read this (some of the Apache settings weren’t correct, initially).

  36. sayyid October 31, 2012 / 10:38 pm

    Thanks Chris that tutorial save my life :)

    syd

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>