430 likes | 691 Views
How to Set Up a Fully-Functional and Legal Web Server for NO Money With that Old PC You’re Not Using Anymore. Dr. Bernie Domanski City University of New York – CSI. Motivation. Have older PCs that still work but its been replaced with a faster, bigger behemoths.
E N D
How to Set Up a Fully-Functional and Legal Web Server for NO Money With that Old PC You’re Not Using Anymore Dr. Bernie Domanski City University of New York – CSI (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Motivation • Have older PCs that still work but its been replaced with a faster, bigger behemoths. • Often, the spouse or one of the kids or Aunt Sophie is the recipient of these working dinosaurs. • This How-To session will take you through configuring your dinosaur to be a fully functional web server that is absolutely on the Internet, is fully legal, and will cost you absolutely nothing but a little bit of time. • If you have Windows, have an account with an ISP, some spare electrical cycles, and can think of what you would do with your own web server, you’re sitting in the right place! (c) Dr Bernie Domanski, 2004. All Rights Reserved.
My Story • A 6 year old Pentium-II that ALWAYS is on our kitchen table. • The core of our version of the neighborhood Internet Café • Wireless connection to a router / cable modem up the stairs. • Why do I need a web server? What’s it worth to me? (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Available Free Webpage Services • e.g. Geocities • Drawbacks • Limited amount of storage • Impossible for audio / video clips • Require banner ads or an advertising bar on your site • Pop-up ads are prevalent • Hard domain names to remember • Try http://www.geocities.com/dslwebserver (c) Dr Bernie Domanski, 2004. All Rights Reserved.
DSL/Cable Webserver Geocities Demo Website (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Pay • Basic package about $20 / month • 25 Mb of disk space • 1-2 Gb of data transfer / month • You live on a server with hundreds / thousands of other websites • Dedicated server? $200-$300 / month • Web Design fee? • Web Content Maintenance? (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Enter a URL (www.domainname.com) into the browser The browser contacts the Client's ISP for the IP address of the domain name The ISP first tries to answer by itself using "cached" data. If the answer is found it is returned. Since the ISP isn't in charge of the DNS, and is just acting as a "dns relay", the answer is marked "non-authoritative" If the answer isn't found, or it's too old (past the TTL), then the ISP DNS contacts the nameservers for the domain directly for the answer. If the nameservers are not known, the ISP's looks for the information at the 'root servers', or 'registry servers'. For com/net/org, these start with a.gtld-servers.net. How DNS works • all the rootservers do is point you to the dns server that really knows • if I am at wideopenwest.com and I do a lookup at cmg.org, I go to WOW, • it goes to root servers and they go to cmg.org or whoever the dns is for cmg.org (c) Dr Bernie Domanski, 2004. All Rights Reserved.
DNS Flow (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Domain Names • Rock bottom prices • .com is more $$$ than .net, .org, etc. • Two options once you have a name: • you can park the domain – no one else can claim the name - or • you get register it completely – requiring 2 DN$ servers • One of several Free Services: • ZoneEdit.com - Highly recommended • But wait !!! (c) Dr Bernie Domanski, 2004. All Rights Reserved.
High-Speed 2.4GHz Wireless Broadband Router HOME NetworkIP: 192.168.0.xSubnet Mask: 255.255.255.0 My Configuration (c) Dr Bernie Domanski, 2004. All Rights Reserved.
When Does the Packet Stay Local? • Routers use a mechanism called a subnet mask. • Looks like an IP address and usually reads "255.255.255.0." • This tells the router that all messages with the sender and receiver having an address sharing the first three groups of numbers are on the same network, and shouldn't be sent out to another network. • Example: The computer at IP 15.57.31.40 sends a request to the computer at IP 15.57.31.52. • The router, sees all the packets, matches the first three groups in the address of both sender and receiver (15.57.31), and keeps the packet on the local network. (c) Dr Bernie Domanski, 2004. All Rights Reserved.
How Cable & DSL Work DSL distances actually vary by brand of equipment, locations, etc check out: http://www.dslreports.com/distance CABLEnewer cable modems are faster than 10Mb/sec DSL (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Router HOME Network IP Addressing ISP Assigned IP Address67.81.124.32 • The ISP assigns you an IP address • This becomes the external address of your cable/DSL modem • If it’s a fixed address (i.e. it never changes), you could create a name for a web server and associate it with the fixed address • But the ISP does change your IP address whenever they feel like it (c) Dr Bernie Domanski, 2004. All Rights Reserved.
192.168.0.1 Router HOME Network 192.168.0.2 192.168.0.3 Internal IP Addressing • Private addresses are assigned to your local machines by the router • Typical private IP address ranges are: 192.168.0.0 – 192.168.255.255 10.0.0.0 - 10.255.255.255 172.16.0.0 – 172.31.255.255 192.168.0.4 (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Confusion about DNS? • What about the DNS servers your DSL/Cable provider gave you along with your IP number. Are these DNS servers the same thing as DNS servers you need to host your own domain name? No they are not. • The DNS servers your DSL/Cable provider gave you: • When you type in Yahoo.com into your web browser, your browser will ask your DSL/Cable provider's DNS servers to translate the domain name (Yahoo.com) into an IP number. Your DSL/Cable provider's DNS server asks Yahoo's DNS server for this information. Yahoo's DNS server gives your DSL/Cable provider's DNS server an answer (an IP number). • The DNS server you need for a domain name: • This server responds to inquiries that are directed to the domain name that is assigned to it. In our example, the DNS server for Yahoo.com answers all requests from the Internet for the domain name Yahoo.com and replies with an IP number. (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Why You Need Dynamic IP Addresses? • If you have a dial-up connection, DSL line, or cable modem, then your IP address keeps changing every time you connect. • Dynamic DNS (from outfits like DynDNS.org, No-IP.com, and ZoneEdit.Com allows your home web server/PC to have a permanent address on the Web FREE. • You can buy a domain name from anyone, and then use the DynDNS outfit to keep the domain name pointing at your web server. (I didn’t buy anything!) (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Web Server Software • Web servers are simple and efficient & won't slow down your machine (much). • My favorites are Apache for flexibility and Microsoft Personal Web Server for ease of use. (c) Dr Bernie Domanski, 2004. All Rights Reserved.
How To Create A Fixed Domain Name The Problem Of A Dynamic IP Address • If you connect to the Internet … • Via a dial-up modem your IP address is very likely to be different. • via a DSL modem your IP address may be different. From my experience of using DSL your IP address can change while you are connected to the Internet. • via a cable modem your IP address may be different. From my experience of using Cable modems, your IP address rarely changes while you are connected to the Internet, and rarely changes when you connect to the Internet on different occasions. • Some Internet service providers (ISPs) offer the option to fix your IP Address (assigning a Static IP address) so that you always obtain the same IP address when you connect to the Internet. However, this option usually costs a little extra to the normal service charges. (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Gotcha’s If I left my router connected to my broadband (DSL or Cable) modem and never powered down both devices, would I keep the same IP Address? NO • With a cable modem I always retained the same IP Address by keeping both the cable modem and broadband router powered up? ALMOST • However, when the cable modem service went down for a period of 12 hours, I obtained a new IP address when the service returned. • With DSL, the IP Address changes frequently even though both the modem & router are powered up all of the time. • I suspect the the PPoE protocol that DSL uses allows a change in IP Address without the loss of service. (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Why Do You Want a Fixed Presence on the Web? • so you don’t have to keep changing HTML pages that reference an IP address that keeps changing (e.g. live web cam streams and live MP3 music streams) • so people know our "address" on the Internet (e.g. for placing a call with NetMeeting or for logging on to an FTP server, SSH server or Terminal server) • You can avoid the problem in the first bullet by using relative addresses i.e. from the home page you use ./ or ../ and so on (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Obtaining A Free Domain Name Service • no-ip.com or dyndns.org. or zoneedit.com • They allow your Internet connection to have a fixed domain name (such as domanski.homeip.net or domanski.dnsalias.com) on the Internet even if your IP address varies each time you connect to the Internet. • These services basically work as follows: • You register a free domain name (more than one if you want) with DynDNS.org (for our example). You specify an e-mail address, username and password during your registration. (c) Dr Bernie Domanski, 2004. All Rights Reserved.
How Do You Get Started? • sign up for a free DNS account • add your domain name to their system • add the current IP Address • download and install a Dynamic Update Client (DUC) (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Dynamic Update Client • Download & install a "dynamic update client" (DUC) application from DynDNS.org. There are many different types of DUC available that support a number of different platforms and operating systems. • The DUC reads your current IP address you have on the Internet & tells the DNS servers at DynDNS.org what your current IP address is. • The DNS servers at DynDNS.org update your domain name according to the IP address you have. • Your domain name is up to date. • If your IP address changes, the DUC tells the DNS servers at DynDNS.org what your current new IP address is. • Some broadband Internet routers have the DynDNS.org DUC already installed. (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Add a Dynamic DNS Host (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Clients, Clients, Clients! (c) Dr Bernie Domanski, 2004. All Rights Reserved.
I Used DNSer v1.3 (c) Dr Bernie Domanski, 2004. All Rights Reserved.
DNSer Service v1.3.3 • This software (DNSer Service v1.3.3) can be used and distributed free of charge for personal and commercial use, providing that the program itself or its documentation is NOT modified in any way and is distributed in original and unmodified ZIP package. (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Modify the .ini File • Installation is very simple, since DNSer needs just two files : • DNSerSvc.exe is the program (service) itself. • DNSerSvc.ini is the configuration file with all necessary settings. However file included in distribution is just a template – you’ll have to edit it yourself. • Details follow … (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Specifics ;-------------------------------------------------; ; This is a template. ; ; You should specify your own settings. ; ; Please consult the manual for more information. ; ;-------------------------------------------------; ;Section [Source] specifies how DNSer should get your router's IP address ;It's set up for DynDNS web detection and you can test DNSer with it. ;However, set it to read your router's info if you intend to use ;it regularly! ;If you need proxy parameters, see the manual about how to use them. ;DynDNS' CheckIP works with ports 80 as well as 8245. ;So, if default URL doesn't ;work, you can try URL=http://checkip.dyndns.org:8245 [Source] Interval=600 URL=http://checkip.dyndns.org User=test Pass=test Proxy= ProxyPort= Prefix=IP Address: Count=1 Log=1 Returns YOUR IP address! (c) Dr Bernie Domanski, 2004. All Rights Reserved.
.ini continued ;Each [Srv] section specifies one server/hostname to update. ;You can have any number of them: [Srv1], [Srv2], [Srv3]... ;This one is set up to update “drbernie.dyndns.org", so you can see ;if it works. Check the DNSerSvc.log to see the result. ;Most probably, you'll get status "good" or "abuse" which is OK ;for user "test": [Srv1] URL=http://members.dyndns.org/nic/update?hostname=drbernie.dyndns.org&system=dyndns&myip=%s User=drbernie Pass=myPasswordForTheDynDNSAccount Proxy= ProxyPort= MinInterval=600 MaxInterval=2160000 StatusOK=good StatusOK1=nochg StatusOK2=abuse LastAttmpt=2004.04.18 20:11:51 LastUpdate=2004.04.18 20:11:52 [Status] LastIP=67.81.51.168 Changed=2004.04.18 20:11:51 (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Router Specifics:A Zillion different routers are listed! ;--------------------; ; Template sections: ; ;--------------------; ;There can be only one [Source] section. So, if you have one of the routers ;listed below, first rename the topmost [Source] section to [Source test], ;then rename the correct section for your router to [Source]. ; ;If you have a router, not listed here, check the manual about how to find ;the correct settings. When you make it work, please mail them to us and we'll ;add them to the template. ;----------------------------------------------------------------------------; ;This is a template for Linksys router ;If your router's LAN IP isn't 192.168.1.1 you should change it accordingly: [Source Linksys] Interval=55 URL=http://192.168.1.1/Status.htm User=admin Pass=admin Prefix=IP Address:</td><td><font face=verdana size=2> Count=2 Log=1 ;----------------------------------------------------------------------------; (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Dynamic IP and ISP's Blocking Port 80 • Thought we were done? Not quite … • Port 80 is by default the port used to transfer information from a web server to your browser. • Some ISP's are now blocking port 80 to stop people from using the connections to run web servers • They may block port 80 but there are many ports, so pick another one!! • 8080 or what ever is open to you! Avoid using ports that are used by other programs!!(I used 5080) • Set your Internet Server to listen on whatever port you choose • Note, • if certain ISPs catch you running a web server • you may be in breach of your contract and they may cut you off (c) Dr Bernie Domanski, 2004. All Rights Reserved.
In Apache for Windows (part 1) … # httpd.conf in the \apache\apache2 directory # Based upon the NCSA server configuration files originally by Rob McCool. # # This is the main Apache server configuration file. It contains the # configuration directives that give the server its instructions. # # The configuration directives are grouped into three basic sections: # 1. Directives that control the operation of the Apache server process as a whole (the 'global environment'). # 2. Directives that define the parameters of the 'main' or 'default' server, # which responds to requests that aren't handled by a virtual host. # These directives also provide default values for the settings # of all virtual hosts. # 3. Settings for virtual hosts, which allow Web requests to be sent to # different IP addresses or hostnames and have them handled by the # same Apache server process. (c) Dr Bernie Domanski, 2004. All Rights Reserved.
In Apache for Windows (part 2) … • Lets take a close look at the httpd.conf file that sets all of the Apache Web Server characteristics … • Click HERE (c) Dr Bernie Domanski, 2004. All Rights Reserved.
But It’s An Ugly URL … • To access your site you would type into your browser http://drbernie.dyndns.org:5080 • Too Ugly!So there is one more thing for me to add!! • To sort that problem you could get another re-direction pointing to your dynamic URL!! • Get a free one like drbernie.shorturl.com from http://www.shorturl.com or drbernie.webhop.net from http://www.dyndns.org/services/webhop/ • Either way set the re-direction address to the http://drbernie.dyndns.org:5080 • All you do then is type in your name drbernie.webhop.net & it will sort everything out without the user knowing that you cant use port 80 or that you have a dynamic IP!! (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Webhop vs ShortURL (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Is That It? • It didn’t work … • Oy! • Trick … modify the hosts file to point to the correct IP address … (c) Dr Bernie Domanski, 2004. All Rights Reserved.
/etc/hosts Try to locate any existing hosts file on your computer: • Windows 95/98/Me • c:\windows\hosts • Windows NT/2000/XP Pro • c:\winnt\system32\drivers\etc\hosts • Windows XP Home • c:\windows\system32\drivers\etc\hosts • You may need administrator access for Windows NT/2000/XP (c) Dr Bernie Domanski, 2004. All Rights Reserved.
It Looks Like # Copyright (c) 1998 Microsoft Corp. # This is a sample HOSTS file used by Microsoft TCP/IP stack for Windows98 # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # For example: # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host 127.0.0.1 localhostdrbernie.webhop.net (c) Dr Bernie Domanski, 2004. All Rights Reserved.
In My Kitchen Right Now (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Summary • You CAN do this! • It’ll take roughly an hour … • The big investment is then in building and maintaining a website! • The Domanski’s never agree on colors, fonts, order of content, etc. • But it’s fun! (c) Dr Bernie Domanski, 2004. All Rights Reserved.
Questions? • Dr. Bernie Domanski • Cell: 908-415-6105 • Email: drbernie@optonline.net • Website: http://domanski.webhop.net orhttp://domanski.cs.csi.cuny.edu/ (c) Dr Bernie Domanski, 2004. All Rights Reserved.