Host Your Own Website Tutorial

My room­mate asked me to cre­ate a web­site for his upcom­ing wed­ding. Well, I decided it would be a good oppor­tu­nity to attempt to host my own web­site. I didn’t know where to begin, but I knew what I had. I had an extra com­puter that had a 2.4 GHz proces­sor, 512MB RAM, and a 160 GB hard drive run­ning Win­dows XP Pro­fes­sional SP2. Now, you don’t need two com­put­ers to do this, but I had the luxury.

There is a lit­tle bit of leg work, but I promise that you will learn a ton; and it will be a very reward­ing 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 con­fig­ure FTP to do remote changes.
  4. Set-up e-mail.

Set­ting Up the Server Environment

WAMPI found a good tuto­r­ial at Life­hacker, but I need some addi­tional infor­ma­tion. To set up my Apache, PHP, and MySQL I needed a WAMP (Win­dows­Apache­MySQLPHP). I tried many, but I found that WAMP5 was by far the eas­i­est to use. While pack­ages like XAMPP have more “stuff” I could never get it to work.

Go down­load WAMP5 and run the install. You can choose where to install it, but I would sug­gest on our C: (or maybe par­ti­tion 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 cre­ate all of your con­tent. Cre­ate a direc­tory under [WAMP Path]/www/, and that is where you can cre­ate your application.

Con­fig­ur­ing Your Router

Now that your appli­ca­tion is ready to go online it’s time to get a domain name! First, we need to con­fig­ure your router for port for­ward­ing or else no one will get to it.

I use a Linksys router, but you can Google how to port for­ward on your router and firmware. I went to my router’s admin sec­tion which for Linksys was http://192.168.1.1/. I then went to “Appli­ca­tions & Gam­ing” and put in the fol­low­ing val­ues for both HTTP and FTP.

LinksysThe HTTP box is from port 80 to 80, and I assigned it the IP of the com­puter I want to for­ward to (to find your IP go to Start — Run — Type “cmd” (no quotes) — Enter — Type “ipcon­fig /all”). I also put in the val­ues for FTP which is from port 21 to 21. Remem­ber to check the “Enable” check­box for both set­tings and save your changes.

Get­ting Your Per­son­al­ized Domain Name

I would sug­gest going over to Dyn­DNS to grab a domain name. You can get a free for­ward­ing address, but if you want your own domain name you’ll have to pay for it (it’s worth it).

DynDNSCre­ate an account, and go to Ser­vices — Cus­tom DNS. Go through their wiz­ard to pur­chase your domain name. After your pur­chase goes through then we’ll need to point your domain name towards your local com­puter. Go to Ser­vices — My Zones and click on your domain name. When you get the options dia­log then enter your exter­nal IP (get it the same way you get your local IP). If you’ve set your IP to be sta­tic or dynamic then choose accord­ingly (there is no rea­son to not use a dynamic IP, because Dyn­DNS has an appli­ca­tion to dynam­i­cally update your set­tings 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 web­site on the WWW! If you selected a dynamic IP then go grab the free IP update client for Dyn­DNS and con­fig­ure it.

Oh wait, there is one more impor­tant step! We need to add an alias on your Apache server to tell the server where to for­ward requests. Get the WAMP menu (right click on the taskbar icon), and go to Con­fig 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 edi­tor sim­i­lar to IIS for Apache, but it is shareware.)

Scroll to the bot­tom to where you see the Vir­tual Host exam­ple. You will add the fol­low­ing infor­ma­tion. This tells the server to lis­ten on port 80 for requests made with a cer­tain domain name, and when that con­di­tion is true it for­wards it to a local direc­tory 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 work­ing domain name, but you’ll want to add FTP capa­bil­ity and maybe e-mail as well. For the FTP sim­ply down­load the FileZilla Server. In there you can cre­ate users and assign appro­pri­ate permissions.

As for e-mail, instead of try­ing 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 uti­lize. Sim­ply sign up for a free account, and con­fig­ure the Gmail sec­tion. There is a tuto­r­ial in there where you’ll have to add MX records in your Dyn­DNS con­fig­u­ra­tion panel, but it’s pain­less. Now you can set up accounts that have 2GB of stor­age and use the Gmail interface!

You’re Done!

Con­grats! You are done! For only $40 you have your own server, per­sonal domain, e-mail, and FTP! If you have ques­tions be sure to pro­vide plenty of infor­ma­tion in the com­ments, and I’ll attempt to steer you straight.

38 Comments

  1. great tut man, but what if you ISP (COX Comm. in my case) blocks com­mon ports like (80,8080 etc)? unless you pay for busi­ness plan, which is way more then res­i­den­tal plans..

    Dan on 02.05.07
  2. Hi Dan! You can use Dyn­DNS’ Web­Hop ser­vice to accom­plish what you need. Let me know if you need more help.

    Chris Poteet on 02.05.07
  3. hey Chis.. i just signed up for that account, how would i go about set­ting every­thing up? I have sta­tic dns set up that points IP to my box, what about port or any­thing else?

    thanks in advance

    Dan on 02.05.07
  4. oh, and i also have my own paid domain name with host­ing server + another domain name (that i wanted to host from my box).. hope that helps

    Dan on 02.05.07
  5. Dan: did you go through their wiz­ard? In the redi­rect URL you can add the http://ipaddress:port/.

    Let me know.

    Chris Poteet on 02.06.07
  6. This is excel­lent. Just what I needed in order to test my web designs. I’ve been delay­ing it because I did not want to go through the has­sle and expense of renew­ing my host­ing account.

    :)

    Colin on 02.06.07
  7. i didn’t see this redi­rect option, awe­some it works now with their sub­do­main.. can you help me out how would i use my own domain name.. i have one but with another company(dotster.com) that i pre­paid for 2 years.. can i use it?
    ps. i don’t have for­ward­ing option with dotster.com

    Dan on 02.06.07
  8. Dan: It looks like your provider does sup­port for­ward­ing.

    Chris Poteet on 02.06.07
  9. Hey Chris.. i got it all up and run­ning, appri­ci­ate your help man, thanks again

    Dan on 02.08.07
  10. No prob­lem! Glad you got it working.

    Chris Poteet on 02.08.07
  11. thanks man great tutorial …

    [ZoDiaC] on 02.19.07
  12. what does it mean when the log file says:
    [error] [client 192.168.1.1] client denied by server con­fig­u­ra­tion c:/(my site)

    leo on 06.15.07
  13. just to add a lit­tle more info… when I try to access the page a get an 403 error in my web­browser and the:
    “[error] [client 192.168.1.1] client denied by server con­fig­u­ra­tion c:/(my site)” in my error­log
    I’m run­ning a router linksys and from what I gather I did sucess­fully enable ports 21 and 80 so it can be for­ward to my pc.
    I’m run­ning the demo from ApacheConf and I set it up just like in their video… when I click “test con­fig­u­ra­tion” (vir­tual host) I get: Syn­tax OK press any key to continue

    I also tried to setup at Dyn­DNS
    Host­name Redi­rected: (my Web­Hop site ).dontexist.org
    Redi­rect URL: http://(my Dynamic DNS site).gotdns.com/
    Cloak Active: N
    Cloak Title:

    (I never saw any place that would talk about redi­rect­ing ports though…)

    leo

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

    Chris Poteet on 06.15.07
  15. Thanks Chris, I really appresiate!

    leo on 06.15.07
  16. more tests
    I dis­conected my router and…
    client denied by server con­fig­u­ra­tion: C:/wamp/www/
    [Fri Jun 15 21:00:17 2007] [error] [client xx.xxx.xxx.xxx] client denied by server con­fig­u­ra­tion: C:/wamp/www/
    [Fri Jun 15 21:42:04 2007] [notice] Apache/2.2.4 (Win32) PHP/5.2.3 con­fig­ured — resum­ing nor­mal oper­a­tions
    [Fri Jun 15 21:42:04 2007] [notice] Server built: Jan 9 2007 23:17:20
    [Fri Jun 15 21:42:04 2007] [notice] Par­ent: Cre­ated child process 4024
    [Fri Jun 15 21:42:04 2007] [notice] Child 4024: Child process is run­ning
    [Fri Jun 15 21:42:04 2007] [notice] Child 4024: Acquired the start mutex.
    [Fri Jun 15 21:42:04 2007] [notice] Child 4024: Start­ing 250 worker threads.
    [Fri Jun 15 21:42:04 2007] [notice] Child 4024: Start­ing thread to lis­ten on port 80.
    [Fri Jun 15 21:42:06 2007] [error] [client xx.xx.xx.xx] client denied by server con­fig­u­ra­tion: C:/wamp/www/

    leo on 06.16.07
  17. @Leo: First off, are you able to suc­cess­fully browse to http://localhost ? You should see the WAMP entry screen.

    Chris Poteet on 06.17.07
  18. yes… http://localhost/ works fine :)

    what’s next?

    leo

    leo on 06.17.07
  19. Do you have Dyn­DNS going to your exter­nal IP like I men­tioned above? Where are you get­ting these error mes­sages from?

    Chris Poteet on 06.17.07
  20. when I go to my account in Dyn­DNS it shows: that:
    IP in Database/DNS = my exter­nal IP address… so my guess is yes.
    I also tried to enter to the site using my exter­nal IP in my browser and it says error 403 (You are not autho­rized to view this page)

    I’m get­ting my error mes­sage from the error.log

    I’m con­nect­ing from “Com­cast cable”

    leo on 06.18.07
  21. For future read­ers: ensure that you have all fire­walls turned off (i.e. the Win­dows one). The router has one by default so your sys­tem won’t be left vulnerable.

    If you’re get­ting “for­bid­den” errors then try this tuto­r­ial.

    Chris Poteet on 06.19.07
  22. Thanks Chris that tuto­r­ial save my life :)

    leo

    Leo on 06.20.07
  23. about turn­ing off Window’s Fire­wall… can i just open the 80 and 21 on the PC’s fire­wall. I would really like to leave it on. I hate the annoy­ing warn­ings about the fire­wall being dis­abled (call me stub­born, but i dont want to dis­able the warn­ings either because i think they are a good thing at times). Great tuto­r­ial too. apache seemed a lit­tle too con­fus­ing to me at first but then i found this and now I am pretty con­fi­dent. I haven’t set it up yet cause i need a lit­tle time, but i will soon. thanks in advance for any help.

    guitardude on 02.21.08
  24. @guitardude: The­o­ret­i­cally, yes that should work, but with Win­dows it’s always a guess.

    Chris Poteet on 02.21.08
  25. Thanks. I installed every­thing, but when i go to the php­MyAd­min page, i get the fol­low­ing mes­sage at the bot­tom of the page:
    Your con­fig­u­ra­tion file con­tains set­tings (root with no pass­word) that cor­re­spond to the default MySQL priv­i­leged account. Your MySQL server is run­ning with this default, is open to intru­sion, and you really should fix this secu­rity hole.
    I tried set­ting up a pass­word on the Priv­i­leges page in php­MyAd­min, but then it started block­ing me from access­ing it. I couldnt get fix it so i unin­stalled, then rein­stalled. How should i fix the prob­lem it is talk­ing about?

    guitardude on 02.21.08
  26. @guitardude: I never saw that until you pointed it out. Just be sure that any access you do with your data­base you do through a MySQL user account.

    Chris Poteet on 02.22.08
  27. I am not really gonna be doing any data­base stuff, at least i dont think so. I just want to make a web­site that has some info about com­puter build­ing and repair that i want to start doing. Will this pose any secu­rity prob­lems to my computer?

    guitardude on 02.22.08
  28. You should be fine, but be sure to only allow port for­ward­ing for port 80.

    Chris Poteet on 02.22.08
  29. Thanks again. You have been a great help.

    guitardude on 02.23.08
  30. i have done every­thing you said.

    i am using linksys wrt54gx

    and com­cast modem

    the dyn­dns uri is just get­ting me to my reuters login which is not good what is up? any­help would be greatly apreciated.

    thanks char­lie

    charlie hoover on 04.28.08
  31. @Charlie: Did you do the port for­ward­ing step?

    Chris Poteet on 04.28.08
  32. I got my domain as godaddy, when i try and for­ward it to my dns ser­vice address which is psyion.ath.cx it tells me tehre is an error.

    any ideas?

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

    Chris Poteet on 05.22.08
  34. hi i have wamp run­ning on my com­puter i am using no-ip with the server i have a web­site 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

    w barnard on 06.06.08
  35. @W: Did you do my direc­tions on DynDNS?

    Chris Poteet on 06.06.08
  36. Just a note to let you know this tuto­r­ial is still being used, and there are a lot of grate­ful peo­ple. Thank you for sharing!

    John on 12.13.08
  37. also, the link is not work­ing for the WAMP5 down­load — here is a valid one: http://www.soft32.com/Download/Free/WAMP5/4–125296-1.html

    John on 12.13.08
  38. You rock dude. Thanks.

    labeeb on 05.26.09

One Trackback

  1. By Episode 11: March 12, 2009 : Tech Gang Show on March 13, 2009 at 3:22 am

Got Something to Say?

(Required)
(Required)