How to Set Up a Fully-Functional and Legal Web Server for

Download Report

Transcript How to Set Up a Fully-Functional and Legal Web Server for

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.
1
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.
2
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.
3
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.
4
DSL/Cable
Webserver
Geocities
Demo
Website
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
5
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.
6
How DNS works






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 rootservers
answer by itselfdo is point you to the dns
all
the
using "cached" data.
server that really knows
If the answer is found it is returned.
Since the ISP
in charge
of the DNS,
•ifisn't
I am
at wideopenwest.com
and I do a
and is just acting as a "dns relay", the
lookup"non-authoritative"
at cmg.org, I go to WOW,
answer is marked
•itisn't
goes
to or
root
servers
and they go
If the answer
found,
it's too
old
(past the TTL), then the ISP DNS
ornameservers
whoever the
dns is for cmg.org
contacts the
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.gtldservers.net.
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
to cmg.org
7
DNS Flow
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
8
Domain Names



Rock bottom prices
.com is more $$$ than .net, .org, etc.
Two options once you have a name:



One of several Free Services:


you can park the domain – no one else can claim the
name - or
you get register it completely – requiring 2 DN$ servers
ZoneEdit.com - Highly recommended
But wait !!!
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
9
My Configuration
High-Speed
2.4GHz Wireless
Broadband Router
HOME Network
IP: 192.168.0.x
Subnet Mask:
255.255.255.0
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
10
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.
11
How Cable & DSL Work
DSL distances actually vary by brand of
equipment, locations, etc check
out: http://www.dslreports.com/distance
CABLE
newer cable modems are faster than 10Mb/sec
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
DSL
12
IP Addressing
ISP Assigned IP Address
67.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
Router
HOME
Network
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
13
Internal IP Addressing


Private addresses are
assigned to your local
machines by the router
Typical private IP address
ranges are:
192.168.0.1
Router
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
192.168.0.2
HOME
Network
192.168.0.3
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
14
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.
15
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.
16
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.
17
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.
18
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.
19
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.
20
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.
21
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.
22
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.
23
Add a
Dynamic
DNS
Host
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
24
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
25
Clients,
Clients,
Clients!
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
26
I Used
DNSer
v1.3
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
27
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.
28
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.
29
;-------------------------------------------------;
; This is a template.
;
; You should specify your own settings.
;
; Please consult the manual for more information. ;
;-------------------------------------------------;
Specifics
;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
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
Returns YOUR IP address!
30
;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.
.ini
continued
31
;--------------------;
; 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.
Router
Specifics:
A
Zillion
different
routers
are
listed!
32
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.
Note,are now blocking port 80 to stop
Some ISP's
people from
usingISPs
the catch
connections
to run
•if certain
you running
a web
servers web server
•you
mayport
be in80
breach
of yourare many ports,
They may
block
but there
contract and
they may cut you off
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
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
33
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.
34
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.
35
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.
36
Webhop vs ShortURL
we do NOT have popup ads, frames,
banner ads, delay pages, or other
advertisements that we use in your
address. We only ask you place a tiny
(88x31) image or text link to us on your
site, and thats it! If you can not add our
link to your page (ie. your page is an
affiliate, MLM or business replica page)
then we do have a small popup
alternative, which does not display
banners, just our link.
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
37
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.
38
/etc/hosts
Try to locate any existing hosts file on your
computer:

Windows 95/98/Me


Windows NT/2000/XP Pro


c:\winnt\system32\drivers\etc\hosts
Windows XP Home


c:\windows\hosts
c:\windows\system32\drivers\etc\hosts
You may need administrator access for
Windows NT/2000/XP
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
39
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 localhost
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
drbernie.webhop.net
40
In My
Kitchen
Right Now
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
41
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.
42
Questions?




Dr. Bernie Domanski
Cell: 908-415-6105
Email: [email protected]
Website:
http://domanski.webhop.net or
http://domanski.cs.csi.cuny.edu/
(c) Dr Bernie Domanski, 2004. All Rights Reserved.
43