Lesson 3 – DNS and XAMPP

Hi gang

Brad here again, and today its time to look at the DNS and why its important.

DNS.

Read what Wikipedia has to say -http://en.wikipedia.org/wiki/Domain_Name_System
We’ll need to know this later on when we want to test our new web server.
Basically, all it does is map “hostnames”, like diyws.ath.cx to a numerical IP address so that someone in Ontario, Canada can connect to your computer in Wellington, New Zealand.

For now, lets learn something about our computer.
Click Start.
Click Run.
Type cmd and click Ok.
At the prompt, type ipconfig and press Enter.
Regardless of how your computer is set up, you’ll see your computers’ IP address.
You’ll need to know what it is, and how to find it a bit later on.

At the prompt, type nslookup diyws.ath.cx and press Enter.
Have a look at the last line of the output where it says Address: – you should see that the IP address for diyws.ath.cx is 122.222.22.128 (of course, this may change from time to time because I am running this site on my own server and I get a different address every time I connect to the Internet)

So we’ve learned two things:
1. How to find our own IP address, and
2. How to find the IP address of another hostname.

Ports.

We’ll be needing to know what they are soon, so its best we get them out of the way too.
A “port” is simply a number that your soon-to-running webserver “listens” on for requests by web browsers.

The standard “port” for web servers is 80, so when you type a web address into your web browser, it knows to try and connect to the webserver host on that port. There are other ways of talking to web servers though (if they run on a different port to the standard 80) – www.example.com:81, where you just append a colon and the number 81 at the end. Try it with port 80 anyway – try www.google.com:80 and see what happens. No difference right? But your web browser did the right thing anyway, and connected to port 80 (as you specified) instead of just using the default 80 port.

Here’s a fun thing to try:
If you still have your black command window open, (if not, click Start, click Run, type cmd and press Enter) type at the prompt:

telnet diyws.ath.cx 80

Update: That doesn’t seem to work in Windows Vista. I’ll find out more about that and let you know!

Update #2: Short answer: Control Panel, Programs and Features, Turn Windows Features On or Off, select the Telnet Client option and click OK

Update #2: Long Answer: Windows IT Pro – Telnet Client

When the server answers (yes, you are now connected to the webserver on port 80) type in: (there is no feedback as to what you’re typing, so type slowly…)

GET / HTTP/1.1 and press Enter.
host diyws.ath.cx and press Enter.
Press Enter one more time.

You will see the actual HTML code of the web page scroll down in the window. If you can’t get it to work, don’t worry – its not that important.

But that’s basically what a web browser does – connects to a computer with an IP address of w.x.y.z on port 80, sends the above commands ie GET and waits for a response. It gets the entire web page code, then “renders” it on the screen according to the HTML, going back to the server for more info ie images and such.

I think that’s probably it for theory.
(Hooray! I hear you all shout in unison…)

Learn all about DNS – another in the “Dummies” series – not that you are, but this makes it much easier to understand than my ramblings above….

Get the software you’ll need.

Now for the fun part!

We’ll be using a collection of software, all bundled together in a single installer, called XAMPP.
xampp movie poster

XAMPP will install the Apache web server, the PHP scripting language, the mySQL database, and the PERL scripting language, all preconfigured to work together “out-of-the-box”. Find out about it, and download it from here: http://www.apachefriends.org/en/xampp.html

Download whichever version you need (regardless of OS – there’s a flavour for everyone!) and go right ahead and install it.
Read the (Windows) FAQ here (paying special attention to number #1 -XAMPP does not work under Windows XP SP2!) – it does actually….
http://www.apachefriends.org/en/faq-xampp-windows.html

I am currently using XAMPP version 1.7.1a and I am also assuming you’re not already running Microsoft’s IIS or Personal Web Server. If you are, shut them down for the purposes of this. I’ll show you how to configure Apache to listen on a different port later.

I’ll wait here until you’re finished.

All done?
Lets just do a quick check on your environment.
Browse to c:xampp (or wherever you installed XAMPP) – double-click the xampp-portcheck file.
This is an important step to ensure that you can run everything. It will tell you what services or other programs are already using the ports that XAMPP needs.

No port issues? Great – now we can start XAMPP.

  • Click Start
  • Click Programs
  • Click Apache Friends
  • Click XAMPP
  • Click XAMPP Control Panel

If the little checkbox next to the Apache and mySQL options are not ticked, then click them to tick them, and then click the Start button on both (if they’re not already)

Done! Apache and mySQL are now started.

Congratulations! You’ve started your own webserver – now its time to see if it works.

Fire up your web browser of choice. Type in http://localhost into the address bar and press Enter.

You should see the big XAMPP logo, and a selection of languages. Click your preferred language, and you should be taken to the default installation webpage.

Let me know how you go.

If everything showed up, you can graduate to Lesson 4

Buy the book! Learning PHP, MySQL and Javascript

Be Sociable, Share!

9 comments on “Lesson 3 – DNS and XAMPP

  1. Pingback: DIY Web Server » Adding the Apture plug-in to enhance your WordPress posts

  2. Hi,
    So far so good, I hope it continues. always wanted to run my own server.
    Thanks for your Tutorial. I will keep you informed how I go.
    Mike

  3. This site stands out among the rest, especially for this niche, please keep us updated with your phenomenal writing style. Have you considered getting a facebook so we can keep up better?

Leave a Reply

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

*

HTML tags are not allowed.