You are on page 1of 20

5.

ru


.
,

www.5ballov.ru.

WWW -
3.1
3.2
3.2.1 WWW - . .
3.2.2 .
3.2.3 MIME
3.2.4 HTTP
3.2.5 CGI
3.3 NCSA
3.3.1
3.3.2 NCSA.
3.3.3 NCSA
3.3.4 .
3.3.5
3.3.5.1
3.3.5.2
3.3.5.3
3.3.6
3.1
WWW - Internet
, , , , ,
WWW - Internet .
WWW
- , .. ,
.
3.2
3.2.1 WWW - . .
WWW - ,
,
. WWW

- ( .
browser), - .

, , WWW-.
:
1. ,
,
o
o
o
o -
o
WWW -
( .3-1).

2. WWW (.
. 3-2).

3. , , .
:
o
o , ,
o () ,
(link) .
.


2, ,
URL. HTTP, WWW
WWW , URL :
1.
2.
3.
4.

, (http).
- Internet IP - .
TCP, .
() - .

:
http://www.cnit.nsu.ru:80/welcome.html
http WWW -

':' -
"www.cnit.nsu.ru" - - Internet
"80" - tcp -
/welcome.html - -

, WWW :
1.
2.
3.
4.

tcp.
http.
.
http.

, WWW - - ,
.

WWW -
.
WWW - .
,
WWW (. . 3-3).

, WWW
,
WWW , - , , ,
WWW .
3-1,
WWW - .
3-1

IBM PC

Sun SparcStation
SparcServer

Unix (UnixWare, Open Server, Solaris, BSD, Linux ..


Microsoft Windows NT
IBM OS/2
Novell NetWare

SunOS
Solaris

Silicon Graphics
IRIS

3.2.2 .
.
.
WWW - . ,
,
.
,
.
:
D:\DOCUMENTS\HTML\INDEX.HTM - Windows,
/u/data/www/html/index.html - Unix - ,
USR:WWW/HTML - NetWare ..
, URL, :
/<_>/ ... /<_>/<_>
, WWW -
.
, , .
1.
, ,
URL.

, D:\Documents\HTML\,
URL
http://<_>/index.htm

D:\Documents\HTML\index.htm
1.
, ,
,
. ,
URL, .
:
/Harvest /projects/www/harvest
/test/myfile.html C:\MYDIR\FILE.HTM
/Harvest
/projects/www/harvest.
.
1.
.
.
, URL .
1.
( Unix) WWW -

( ,
..). (..
"") . URL
: ~<_>.
:
Indy.cnit.nsu.ru fancy ""
/home/fancy.
/home/fancy/public_html. URL http://Indy.cnit.nsu.ru/~fancy/start.html,
WWW - start.html /home/fancy/public_html.
3.2.3 MIME
MIME - ,
: , ,
. , on-line , WWW.
MIME .

MIME
, .
MIME.
, . :
Content-Type: <_MIME>
MIME (.. )
.
MIME:
<> / <> [ ; <> ]
<> - :
Audio -
Application - , - ()
Image -
Message - , MIME -
Multipart - , MIME -
Text -
Video - .
<> - <>
:
text/html - HTML
image/giff - gifF
<> - , .

MIME .
:
<>/<> <1> ... <N>
, ,
MIME.
:
image/giff gif giff
text/html html htm
gif giff
image/giff. image/giff
(, ),
gif giff.
3.2.4 HTTP
HTTP WWW - WWW - .
:

<>
<> < / >

- HTTP ;
- :
GET -
PUT, POST - (, )
:
HTTP/1.1
GET /index.html
index.html .
3.2.5 CGI

.
WWW CGI (Common Gateway
Interface). CGI
WWW .
CGI , URL
. WWW ,
, , .
CGI -
- (Basic, SH, Perl ..).
CGI - ,
CGI -
. cgi-bin
, , .
:
, CGI - test-query, URL
http://<_>/cgi-bin/test-query
CGI WWW - . CGI ,
, ..
, , 4 .
3.3 NCSA
(NCSA)
,
WWW - . WWW - NCSA .
,
, , ..
3.3.1

NCSA
, Unix.

. "Unix PC" (Solaris, SCO, UnixWare, Linux, BSD, BSDI),
2 Mb . ,
, 2Mb,
,
.
3.3.2 NCSA.
NCSA ,
.
httpd_< >-<> < > -
WWW , <> - .
:
httpd_1.5.1-export
:
README - .
.
COPYRIGHT -
WWW - NCSA.
CHANGES -
.
Makefile - make. ,
WWW - .
src - .
conf - , .
icons - , , .
cgi-bin - , CGI - .
cgi-src - , CGI - .
support - , ,
.
3.3.3 NCSA

, , make.
make :

aix3, aix4, sunos, sgi4, sgi5, hp-cc, hp-gcc, solaris, netbsd, svr4, linux, next, ultrix, osf1, aux,
bsdi. , make
. .

. , hp-cc hp-gcc HP-UX, - C (cc) GNU C (gcc). UnixWare
make svr4.
- ,
. , ,
src/config.h.
.
httpd /usr/local/sbin /usr/sbin. , cgi-
, ServerRoot.
/usr/local/etc/httpd, HTTPD_ROOT
src/config.h, -d .
:
/usr/local/sbin/httpd -d /var/httpd
, ServerRoot, :

conf/ -
logs/ -
cgi-bin/ - cgi-, .

3.3.4 .
() ,
, . ,
conf/ httpd.conf.
, -f.
:
/usr/local/sbin/httpd -f /etc/httpd.config
, ,
.
.
, .

1. ServerType
:
ServerType inetd
inetd. , .

ServerType standalone
. ,
.
2. Port
tcp, .
standalone. inetd
inetd - inetd.conf.
WWW - - 80.
:
Port 80
3. StartServers MaxServers
standalone
. StartServers - ,
httpd. MaxServers
.
:
StartServers 3
MaxServers 5
4. TimeOut
( ), ,
standalone, .
1200 .
:
TimeOut 3600
5. User Group
,
standalone.
WWW - ,
. :
User nobody
Group nobody
WWW -
1. ServerName
,
. ,
().

:
ServerName Indy.cnit.nsu.ru
2. ServerAdmin
.
- ,
Email.
:
ServerAdmin fancy@nsu.ru

1.
2. ServerRoot
ServerRoot. ,
/usr/local/etc/httpd HTTPD_ROOT
src/config.h.
:
ServerRoot /var/httpd
3. ErrorLog
- ,
, .
slash (/), ServerRoot.
:
ErrorLog logs/errlog
/var/httpd/logs/errlog
4. TransferLog
- ,
WWW - WWW - .
slash (/), ServerRoot.
:
TransferLog logs/translog
/var/httpd/logs/translog
5. AgentLog
- ,
, WWW
. slash (/),
ServerRoot.

:
TransferLog logs/agentlog

/var/httpd/logs/agentlog
6. RefererLog

.
slash (/), ServerRoot.
:
RefererLog logs/reflog
/var/httpd/logs/reflog
7. PidFile
, WWW .
kill. slash (/),
ServerRoot.
:
PidFile logs/httpd.pid
- /var/httpd/logs/httpd.pid
8. AccessConfig
.
slash (/), ServerRoot.
:
AccessConfig conf/access.conf
9. TypesConfig
,
MIME. conf/mime.types
, ServerRoot. backslash (/),
ServerRoot.
:
TypesConfig /etc/mime.types
10. CoreDirectory
,
.

:
CoreDirectory /tmp

1. LogOptions
, (Combined)
(Separate).
:
LogOptions Separate
2. RefererIgnore
, .
:
RefererIgnore Indy.cnit.nsu.ru

1. DNSMode
WWW .
Minimum , DNS
. Standard ,
. Maximum
,
.
:
DNSMode Standard


. /usr/local/etc/http/conf
httpd.conf.
src/config.h. HTTPD_ROOT, -
SERVER_CONFIG_FILE. ,
-h -f (. ).
, , MIME,
. -
, (. src/config.h).

,

. .

1. DocumentRoot
,
URL.
:
DocumentRoot /apply/www
2. UserDir
. WWW -

.
, UserDir.
URL:
http://<_>/~<__>
,
UserDir <__>.
:
UserDir public_html
URL
http://www.nsu.ru/~fancy/index.html
Index.html public_html/
fancy.
3. Redirect
,
.
:
Redirect /HTTPd/ http://hoohoo.ncsa.uiuc.edu/
4. Alias
.
:
Alias /icons /var/opt/images
5. ScriptAlias
, CGI - .
:

ScriptAlias /hrv-cgi /var/opt/cgi


6. DirectoryIndex
, .
.
:
DirectoryIndex index.html index.htm index.cgi
7. AccessFileName
, (.
).
:
AccessFileName .htaccess
3.3.5
3.3.5.1
.
Unix - , standalone, ,
httpd:
# ps -aef | grep httpd
root 28816 1 0 Nov 14 ? 7:42 /usr/local/sbin/httpd
nobody 28817 28816 0 Nov 14 ? 5:50 /usr/local/sbin/httpd
nobody 28818 28816 0 Nov 14 ? 5:32 /usr/local/sbin/httpd
nobody 28819 28816 0 Nov 14 ? 4:49 /usr/local/sbin/httpd
nobody 28820 28816 0 Nov 14 ? 5:24 /usr/local/sbin/httpd
nobody 28821 28816 0 Nov 14 ? 5:42 /usr/local/sbin/httpd
root 19150 19145 0 14:57:58 pts/4 0:00 grep httpd
#
, root,
- , User
(). root .
- . ( 8
) .
inetd
, telnet, - .
GET /.
,
. 80. standalone
Port . inetd - services inetd.conf,
tcp - Unix.

:
$ telnet www.cnit.nsu.ru 80
Trying 193.124.209.70...
Connected to Indy.
Escape character is '^]'.
GET /
<HTML>
<HEAD>
<TITLE>Novosibirsk Center of New Information Technologies</TITLE>
</HEAD>
<BODY
...
</BODY>
</HTML>
Connection closed by foreign host.
$
3.3.5.2

. inetd,
.
. standalone,
- .
. ,
. "" - ,
. "" -
kill , PidFile (. ).
:
kill `cat /usr/local/etc/httpd/logs/httpd.pid`
mv /usr/local/etc/httpd/logs/*.log /otherdir
/usr/local/sbin/httpd
,
"" , ..
3.3.5.3
NCSA .
,
WWW - , / ,
/.
/

.
, AccessFileName
. , .htaccess.

.htaccess
AuthUserFile /otherdir/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic
<Limit GET>
require user pumpkin
</Limit>
AuthUserFile ,
.
Limit GET GET,
pumpkin. (, CGI)
:
<Limit GET POST PUT>
require user pumpkin
</Limit>
htpasswd,
:
htpasswd -c /otherdir/.htpasswd pumpkin
pumpkin
/otherdir/.htpasswd.
/
/ ,
, Limit.
1. . ,
-c (create) htpasswd:
htpasswd /otherdir/.htpasswd peanuts
htpasswd /otherdir/.htpasswd almonds
htpasswd /otherdir/.htpasswd walnuts
2. , , , /otherdir/.htgroup
:
my-users: pumpkin peanuts almonds walnuts
my-users - ,
pumpkin, peanuts, almonds, walnuts - , .
3. .htaccess :

AuthUserFile /otherdir/.htpasswd
AuthGroupFile /otherdir/.htgroup
AuthName ByPassword
AuthType Basic
<Limit GET>
require group my-users
</Limit>
my-users
( ).


- . ,
.
.
cnit.nsu.ru:
.htaccess:
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName ExampleAllowFromCNIT
AuthType Basic
<Limit GET>
order deny, allow
deny from all
allow from .cnit.nsu.ru
</Limit>
order :
, .
deny from all - ,
allow from .cnit.nsu.ru - cnit.nsu.ru.
AuthName -
.
nstu.nsk.su:
.htaccess:
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName ExampleAllowFromCNIT
AuthType Basic

<Limit GET>
order allow, deny
deny from .nstu.nsk.su
allow from all
</Limit>
3.3.6
, ,
. :

- 8 8 -
Microsoft Code Page 866 ("") - , MS-DOS
ISO-8859-5 - ,

Microsoft Code Page 1251 ("Windows") - , Microsoft


Windows.

11
.
WWW

,
.
, .

. 99%
.
, HTML ,
. ,
,
. , ,
.
,
:

-
,
, , WWW - .
,
.
.
:
indexw.html, indexa.html - , .

.../koi8/index.html, .../win/index.html -
.
- ,
,
- . -
- WWW ,
cron, at.
,
- ,
WWW - . CGI - ,
.
WWW - ,
(. . 12.1)

- WWW -
(..12.2). PROXY.

, ,
, . PROXY
-
MIME , , .
tcp . PROXY URL.
:
http://www.nsu.ru:80/index.html - -8,
http://www.nsu.ru:8000/index.html - ISO-8859-5 ..