apache

Download Apache

If you can't read please download the document

Upload: -

Post on 28-Oct-2014

76 views

Category:

Documents


0 download

TRANSCRIPT

web server Apache: : www.dhstudio.eu

1. WEB 1.1. Web . ,

1.2. Web 1.2.1. Web 1.2.2. Web 1.3. Web 1.4. Hypertext Transfer Protocol ( HTTP ) 1.5. , Web Apache 1.5.1. Apache 1.5.2. Apache 1.5.3. Apache 2. APACHE 2.1. Apache 2.1.1. Apache MS Windows 2.1.2. Apache GNU/Linux 2.1.2.1. Apache RPM 2.1.2.2. Apache DEB 2.1.2.3. Apache 2.1.2.3.1. 2.1.2.3.2. Apache 2.1.2.3.3. 2.1.2.3.4. configure make 2.2. Apache 2.2.1. apache2.conf . 2.2.1.1. 2.2.1.2. Apache 2.2.1.3. IP . 2.2.1.4. 2.2.1.5. . 2.2.1.6. 2.2.1.7. 2.2.1.8. 2.2.1.9. 2.2.2. Apache 2.2.2.1. mod_php 2.2.2.1.1. PHP 2.2.2.1.2. PHP 2.2.2.1.2.1. PHP DEB 2.2.2.1.2.2. PHP RPM

2.2.2.1.3. PHP 2.2.2.1.3.1. mod_php apt apt-get 2.2.2.1.3.2. PHP yum 2.2.2.2. mod_perl 2.2.2.2.1. mod_perl 2.2.2.2.1.1. mod_perl DEB 2.2.2.2.1.2. mod_perl RPM 2.2.2.2.2. mod_perl 2.2.2.2.2.1. mod_perl apt apt-get 2.2.2.2.2.2. mod_perl yum 2.2.2.3. mod_python 2.2.2.3.1. mod_python 2.2.2.3.1.1. mod_python DEB 2.2.2.3.1.2. mod_python RPM 2.2.2.3.2. mod_python 2.2.2.3.2.1. mod_python apt apt-get 2.2.2.3.2.2. mod_python yum 2.2.2.4. mod_cband 2.2.2.4.1. mod_cband 4.0 (Etch) 2.2.2.4.2. mod_cband 2.2.2.4.3 mod_cband 2.2.2.4.4 mod_cband 2.3. Web Apache 2.3.1. . . 2.3.2. 2.3.3. iptables 2.4. Apache 1. WEB 1.1. Web . , . - - . Web Web . , Web , HTTP

. Web , , . Web Web -. Web . , Web Web . : Web Web Web . , Web . , Web . Web Web , . 1.1. - Web Web

. 1.1 Web Web , Web (Uniform Resource Locator, URL). Web , , URL ( URL ), . URL , . , , Apache, URL : http://www.apache.org:80/faq.html. URL

: : URL , . - URL HTTP (Hyper-Text Transfer Protocol). HTTP - . : URL , www.apache.org : . , 80 HTTP , Web . : , . faq.html . , . Web Web , Web Web . : , (http://www.apache.org) IP . , IP . IP , . 80, HTTP , . , , GET. GET faq.html Web , , . HTML . HTML Web . Web HTML , HTML . Web , . , HTML . Web , HTML , , , ,

. Web , - Web . . Web , . , Web . CGI (Common Gateway Interface) . CGI : CGI , Web Web CGI . Web CGI Web . CGI HTML , Web . 1.2 :

Web .

1.2 1.2. Web ( ) ( ). . , . ( ). . , . Web . Web , , . Web , ( ) . 1.2.1. Web ( ) Web Web Apache. Apache - Web , Web . - Web : - Apache Apache - Web . Apache . Web Apache , , . Web : http://httpd.apache.org/ . Apache:

1.3 - Boa 1991 . Web Boa. , , . Web Boa Web , . , Boa , . Web , Boa HTTP . HTTP , . Boa Web : http://www.boa.org - Red Hat Content Accelerator (RHCA) Red Hat Content Accelerator (RHCA) HTTP , GNU/ Linux. Web Red Hat . RHCA . RHCA Web :http://www.redhat.com/docs/manuals/tux/TUX-2.2-Manual/intro.html

- Mathopd Mathopd Web , . , Mathopd

Unix GNU/Linux. , , , , Mathopd - . Web , . Mathopd . Web : http://mathop.diva.nl/download.html 1.2.2. Web Web , , , Web . Web , Web , . IIS, IBM, Zeus, Roxen, iPlanet Stronghold - . Web : - Microsoft IIS Microsoft Internet Information Server Web , . Microsoft IIS Windows NT, Windows 2000 Windows XP. IIS Web , . , : Windows NT, Windows 2000 Windows XP. IIS Unix, GNU/ Linux Solaris. IIS :http://www.microsoft.com

IIS:

1.4 - IBM IBM HTTP Server e IBM Web Apache. IBM , Web Apache . , IBM HTTP Server IBM Websphere Application Server. Web Web :http://www3.ibm.com/software/webservers/httpservers/

- Zeus Web Zeus GNU/Linux Unix. , Zeus . Apache/NCSA/httpd . Web . Web : http://www.spec.org/osg/web96 - IPlanet Web iPlanet - Web . Sun Netscape. Web iPlanet - . Java, , Java.

iPlanet . , iPlanet, Solaris, GNU/Linux, Windows . Web iPlanet Sun ONE. Web : http://www.sun.com/software/iplanet/products/iplanet_application/home_ias.html - Stronghold Web . Web Stronghold Apache, Secure Socket Layer (SSL) . : http://www.redhat.com/software/apache/stronghold/ Web Netcraft Web . 2008 Netcraft 155.583.825 , - 354 5.4 . Apache . blog , . 1995- 2008

1.5 1995 2008-02-21

1.6

1.7

1.8 2000- 2008

1.9 Netcraft 2:08 . 28 2008 . 1.3. Web Web HTTP . : - . Web , . , , Web . . , , , /IP . , , . - . , Web , . , Web .

- . Web , . Web Web , ( ) . . - CGI Web , CGI . CGI , . 1.4. Hypertext Transfer Protocol ( HTTP ) HTTP , . - , HTTP , , Web . HTTP, HTTP/0.9 1991 . . . Web , HTTP , :`11W``2`12 GET /inex.html , index.html Web , Web . , Web . 1996 . (Request For Comments- RFC) HTTP 1.0. . .. (headers) . , . : Content-Type: text/html , HTML. Web , . HTTP e HTTP 1.1. 1999 . RFC 2616. HTTP/1.1 HTTP . Web , Apache IIS, HTTP/1.1. HTTP/1.1 :

- - , HTTP/1.1 HTTP, Web , URL. HTTP/1.1 . , URLhttp://www.apache.org, www.apache.org. Web IP . , IP . . www.apache.org, www.php.net. , , IP . . - HTTP IP . . - HTTP/1.1 . HTTP/1.1 , GET, HEAD POST. : OPTIONS DELETE PUT TRACE - HTTP/1.1 . Web , , . Web . , shockwave , . , . , . , Web , . . , . , ,

. HTTP/1.1 , . - , HTTP/1.1 . . , . , , . , Transfer-Encoding . : Transfer-encoding: chunked chunked ( ) , . , , . . , . , . - HTTP/1.1 . . , . Range , : Range: bytes=400-600 400-600, 200 . - , Web , . Web , . , .

Web . Web , Web . HTTP 1.1 , HTTP, 1.0, HTTP/1.1 . HTTP/1.1 , , HTTP/1.0 HTTP/1.1, . . Web , . HTTP/1.1 , HTTP/1.0 . HTTP/1.0 If-Modified-Since . , . HTTP/1.1 , . , - . , , . Web HTTP/1.1 Etag. HTTP/1.1 If-None-Match, If-Unmodified-Since If-match. , If-None-Match - HTTP/1.1 Upgrade. . , . Upgrade , . Web , , , Upgrade. , , . 1.5. , Web Apache 1.5.1. Apache Apache e HTTP Web , . Web Apache e HTTP ,

(National Center for Supercomputing Applications) , . Web Web , . . 1994 . , Apache. Apache. Web Apache a patchy (, Apache, ). - Apache. : , , , , , , . Web Apache, 0.6.2 1995 . , Web . , 1995 . - Apache 1.0. , . 1999 . Apache Apache. , Web Apache. Web Apache, Web , . , Apache , . HTTP Apache. Apache , , , , . 1.5.2. Apache - Apache Web (http://httpd.apache.org) . , , , .

, . Apache. . - Apache , . Apache ( GNU/Linux-, MS Windows-command prompt). Apache : 1) . ( ) RPM (RedHat Package Manager) Linux Red Hat. Linux Red Hat. . . . , Linux Mandrake, Debian Red Hat . , Linux. 2) , Linux. . , . - Apache , Linux. , . , Apache . , , Apache, , , Web . - Apache. , , Apache. Webbing. : http://www.webmin.com/. Webmin :

1.10 - Apache . , ( ) . , , . Web . . . , . . , , Unix. Apache. Apache, . Apache - , Web , . - . , . . Java. . , Java, .

. Web Apache. , , Web Apache . , Web . - , , Apache . Apache. Apache . Apache , Apache Module API. Apache Module API, C Purl. Apache, . - Apache , - . Apache () Secure Sockets Layer (SSL). Apache , Oracle MySQL. . , SSL Apache, mod_ssl. SSL , Web . SSL . , Apache. , Apache Web - HTTP/1.1 Apache e Web , HTTP/1.1. , HTTP/1.1 , , , , . HTTP/1.1 Apache -

Web . - Apache , , . , Apache, PHP(Hypertext Preprocessor), ASP (Active Server Pages), JSP (Java Server Pages) . - Apache . mod_proxy, Apache . Apache , Web , . intranet, . Web - . . - Apache , . Web . , , Apache . - Windows Apache , Windows, Windows NT, Windows 2000, Windows 98 Windows 95. , Apache , . - Apache , Web . . Web . URL Web , . ,

. - Web Apache. , , Linux, UNIX, Windows, Solaris, BeOs, mainframe. 1.5.3. Apache Apache (, , , ). ( , ). Web , - Apache. , Apache . Web Apache. Web . HTTP , Web . Web , . Web . Web , , . , Web . Web , . Web httpd,Medusa Zeus.Web , , . . Web , , Web , , , Web . IIS MS Windows Web . , Apache GNU/Linux Web . , MS Windows ( , - GNU/Linux), Apache MS Windows .

. , Apache . : . , . , , Apache. , . , . - . Web , GNU/Linux. , , , . , . , . , . , . Apache . : (Uniform Resource IdentifierURI). Web Apache . Web Apache . (authentication ID). . , Web Apache . . . . Web , . MIME . , Apache MIME . . Apache . . .

. Apache . Apache . , Apache : . Apache . , Apache . . . 1.3 .

1.11 HTTP Apache Apache. , Apache . . , . , : . carol.c . , . . http_core.c Apache .

, (.. Apache ), - . . http_main.c Apache. . . , . . . protocol.c Apache. , . . http_request.c . . . http_config.c . o Apache, Apache. , , Web Apache. Web , . .

: Web Web . , : . - Web Microsoft IIS, - Apache. Apache e HTTP Web , . Web Apache e HTTP , (National Center for Supercomputing Applications) , . , Web Apache - Web , Apache .

2. APACHE 2.1. Apache Web Apache GNU/Linux

Debian,Red Hat, Fedora, Ubuntu . Apache Web .. MS Windows. Apache ( source code ). Apache . , . GNU/Linux, Red Hat RPM(RPM Package manager), Debian, Ubuntu DEB. Web . RPM DEB , .. , Apache. MS Windows Apache . 2.1.1. Apache MS Windows Apache . Apache. .msi (Microsoft System Installer). , , . , Apache, Apache Windows 95, Windows 98, Windows ME. , Apache , Apache . Apache Web : http://www.apache.org/dist/httpd/binaries/win32/ . 2.1.1.1 Web Web Apache.

2.1.1.1 Web , Apache MS Windows Apache MS Windows - . Apache MS Windows XP: 1) Apache, . 2) . [Next] 3) Apache. [Next]. 4) Apache, [Next] 5) 2.1.1.2 :

Apache MS Windows XP

. 2.1.1.2 6) Complete [Next] 7) Apache. (: C:\) . [Next], Apache, .( :\ Apache.) 8) Install . 9) Apache [Finish] . 2.1.2. Apache GNU/Linux Apache GNU/Linux RPM, DEB ( source code ) 2.1.2.1. Apache RPM apache RPM rpm. rpm , .

rpm : rpm i Apache_XX.rpm . I rpm e Apache_XX.rpm . e . rpm q Apache_XX.rpm . q , . qa . rpm, Apache : rpm I httpd-2.0.59-1.i386.rpm Web Apache RPM . GNU/Linux : RedHat, Fedora RPM . 2.1.2.2. Apache DEB .deb Debian, Ubuntu . .deb dpkg- Debian. , dpkg: dpkg i apache_2.0.49.deb .deb apt - apt-get. apt-get: apt-get install apache 2.1.2.3. Apache Apache , RPM DEB . Apache . . GNU/Linux, - Apache GNU/Linux Apache GNU/Linux : 12 MB. Apache 3MB .

. , ANSI-C . GNU C (gcc) Perl 5. Apache , apxs dbmmanage, Perl. Apache Perl 5. , . (DSO) . DSO . 2.1.2.3.1. Apache. Web Apache. , tar GNU/Linux GNU Zip, .tar.go, .tags .be2. Apache Apache:http://www.apache.org/dist/httpd/

2.1.2.3.2. Apache , . GNU/Linux, /usr/local/src. . : tar zxvf httpd-2.0.61.tar.gz , . 2.1.2.3.3. , GNU/Linux Apache www-data. Apache, www-data. www-data web. web : # web

groupadd web # web web useradd g web web 2.1.2.3.4. configure make Apache configure. - Apache. Apache. , . configure : Apache . , . - , Apache. . make , Apache. configure . Apache, . Web , . Apache . , Apache Apache. , Apache: ./configure with-layout=RedHat Apache. withlayout=RedHat , , , Red Hat Linux . , . , , Apache. configure , : ./configure prefix=/usr/local/apache \ --enable-module=most \ --disable-module=auth_dbm \

--enable-shared=max prefix=/usr/local/apache , Apache . /usr/local/apache. , Apache. . , Apache , . , GNU/Linux. , Apache . Apache . enable-module=most , Apache . , . enable-module=most , . enable-shared=max . , http_core module mod_so , . Apache. , http_core Apache. mod_so . Apache 1.3. , Apache. , Apache. Apache , . 1. Apache: ./configure prefix=/usr/local/apache \ --server-uid=web \ --server-gid=web \ --htdocsdir=/var/www \

--cgidir=/usr/lib/cgi-bin/ \ --enable-module=most \ --enable-shared=max . server-uid=web (Web ) , Apache web. server-gid=web , Apache web. htdocsdir , Web /var/www/. cgidir=/usr/lib/cgi-bin/ , CGI /usr/lib/cgi-bin/ ./configure config.layout. , . config.layout . , Apache , . . . , Apache , . , . . . configure, Apache , . , Apache config.layout, . , Apache , . Apache . : # Classical Apache path layout. prefix: /usr/local/apache2 exec_prefix: ${prefix} bindir: ${exec_prefix}/bin sbindir: ${exec_prefix}/bin libdir: ${exec_prefix}/lib

libexecdir: ${exec_prefix}/modules mandir: ${prefix}/man sysconfdir: ${prefix}/conf datadir: ${prefix} installbuilddir: ${datadir}/build errordir: ${datadir}/error iconsdir: ${datadir}/icons htdocsdir: ${datadir}/htdocs manualdir: ${datadir}/manual cgidir: ${datadir}/cgi-bin includedir: ${prefix}/include localstatedir: ${prefix} runtimedir: ${localstatedir}/logs logfiledir: ${localstatedir}/logs proxycachedir: ${localstatedir}/proxy config.layout , . . , prefix . prefix, - Apache. , configure Apache. Apache : make. make Apache. make ./configure ( ). make Apache. Apache , make install. . , . Apache, --prefix Apache Apache, : apache2ctl. - apache2ctl: start Apache stop Apache restart- Apache, SIGHUP

fullstatus Apache ( lynx mod_status) status Apache ( lynx mod_status) graceful SIGUSR1 . configtest Apache , apach2ctl: apache2ctl configtest Syntax OK , Apache , , Apache : apache2ctl start Apache . , lynx : lynx http://localhost URL IP Apache. :http://82.137.123.111

, telnet nc: nc 82.137.123.111 80 GET index.html telnet 82.137.123.111 80 GET index.htm1 2.2. Apache Apache apache2.conf , email Web ServerAdmin ServerName . GNU/Debian apache2.conf /etc/apache2/apache2.conf . . apache2.conf :

find / -name apache2.conf find (/) apache2.conf . apache2.conf ServerAdmin ServerName . - : ServerAdmin [email protected] ServerName www.dhstudio.eu DocumentRoot Web . DocumentRoot /var/www/. Web , : grep ^DocumentRoot /etc/apache2/sites-enabled/000-default| awk '{print $2}' /etc/apache2/sites-enabled Web 000-default. Apache index.htm, index.html index.php , . 2.2.1. apache2.conf . apache2.conf ASCII . # (), . , , . : Listen 443 Listen 443. , apache2.conf , . , , Directory . apache2.conf: Directory ,

, . , Directory , . Files , , --. , Files , . -- , * ?. , Files ~ (), -- . Location , . , Location , . IfDefine , apache. , DHAVE_SSL apache. IfDefine IfModule , . , , mod_userdir. . , Web . , Web , . . Location . apache2.conf 668 . - Apache . , , apache.org . : , . apache, , .

, - , , .

2.2.1.1 , - apache2.conf LoadModule AddModule. apache2.conf . Dynamic Shared Object (DSO) , Web Apache. Apache . , DSO Apache . : dhstudio# apache2 -l Compiled in modules: http_core.c mod_so.c , Apache. : http_core . . Apache. , Web Apache. . . mod_so.c . Dynamic Shared Object . , . apache2.conf, Apache, . Apache. apache2.conf . . , LoadModule. - , , apache2.conf: LoadModule agent_log_module /modules/mod_log_agent.so LoadModule . LoadModule,

AddModule. , . - , , , - , . agent_log_module , apache2.conf: AddModule mod_log_agent.c AddModule . LoadModule, , . , . LoadModule mod_log_agent.so. mod_log_agent.c. , (shared objects), .so, , C, .c 1 : Apache 1 mod_access mod_actions mod_alias mod_asis mod_auth mod_auth_anon mod_auth_db mod_autoindex mod_bandwidth mod_cgi mod_dav mod_dir mod_env mod_expires mod_headers CGI MIME , . CGI WebDAV CGI SSI Expires

- (images maps) SSI mod_log_agent - . mod_log_config mod_log_referer referrer , , mod_mime MIME mod_negotiatio MIME n mod_perl MIME mod_php PHP mod_php3 PHP mod_php4 PHP mod_put PUT DELETE mod_python Python mod_rewrite URI mod_roaming Netscpe Roaming Access mod_setenvif . mod_so (DSO) mod_ssl Secure Sockets Layer mod_status Web . mod_throttle . mod_userdir Web mod_vhost_alia , s . 2.1 2.2.1.2. Apache . ServerAdmin e-mail Web .

mod_imap mod_include mod_info

root@localhost root localhost. ServerAdmin: ServerAdmin [email protected] e-mail Web [email protected] ServerAdmin. ServerName , , . ServerName , .. . , , , amri.dhstudio.eu, , Servername . UseCanonicalName , ServerName. UseCanonicalName apache URL- , . on, , , ServerName. off, , . Web , UseCanonicalName off, , . ServerRoot , apache. DocumentRoot- , . Debian /etc/apache2/. . ServerType . , standalone. inetd xinetd, ServerType inetd. - Web , - . , Web GNU/Linux . inetd xinetd. Port TCP , . 80. Web 8080 8000 . 80 8080, Web http://www.dhstudio.eu : http://www.dhstudio.eu:8080 ServerType inetd, Port , 80. , 1024

. 80, apache inetd root. , root Web . ServerType standalone, 80, apache . , HTTP , root . 2.2.1.3. IP . Web , , multi-homed . IP . . : Bind Address apache . * , , Web , IP . Bind Address , , . Listen- apache Web . - . , 8080 IP 172.16.2.13, 172.16.2.2.13:8080. . Listen , apache , Port. 2.2.1.4. DocumentRoot, , Web . , . ServerRoot. : DocumentRoot /var/www ServerRoot /etc/apache2 PidFile ScoreBoardFile . PidFile , apache , ScoreBoardFIle , apache . ScoreBoardFile , Apache , .

Alias ScriptAlias URL . : Alias /icons/ /usr/share/icons ScriptAlias /cgi-bin/ /var/lib/cgi-bin/ URL /icons/ /usr/share/icons. www.dhstudio.eu/icons www.dhstudio.eu/usr/share/icons/. ScriptAlias , Alias, , , , CGI . UserDir Web , . UserDir public_html. public_html , Web . www.dhstudio.eu/~amri , www.dhstudio.eu/home/amri

, /home/userpages, UserDir. . www.dhstudio.eu/~amri www.dhstudio.eu/home/userpages/amri/. , , . , . DirectoryIndex , , . : DirectoryIndex index.html index.htm index.shtml index.php index.php5 index.php4 index.php index.phtml index.cgi DocumentRoot , http://www.dhstudio.eu/amri, /var/www/amri/index.html. , DocumentRoot , DirectoryIndex , . , . , index.htm, index.shtml index.cgi. , DirectoryIndex, , apache .

2.2.1.5. FancyIndexing IndexOptions, apache , , . , : IndexIgnore: , . , , (wildcards). HeaderName: , , . Readname: , , . AddIcon: , . DefaultIcon , , AddIconByEncoding: , MIME . AddIconByType: , MIME . 2.2.1.6. MIME . . MIME apache2.conf. : DefaultType: MIME , . text/html. , , , HTML . AddEncoding: MIME . : AddEnconding: x-compress Z

AddEncoding: x-gzip gz tgz .Z MIME x-compress. .gz .tgz MIME x-gzip. AddLanguage : MIME . LanguagePriority: , . AddType : MIME AddHandler : . (file handler) , . cgi-script , CGI server-parsed, Server Side Includes (SSI). 2.2.1.7. Web NCSA (National Center for Supercomputer Appliations), , . CPU, . HTTP . Apache . . . apache , . apache2.conf . , , : MinSpareServers: , . 5. , httpd 5. MinSpareServers MaxSpareServers: , . httpd , . , .

StartServers: httpd , . 8, ps, , httpd . , , . , . MaxClients: , . , . 150. , MaxClients , , HARD_SERVER_LIMIT Apache. 256. MaxClients , . MaxRequestsPerChild: , , . MaxRequestsPerChild , , . Apache 10000, . , MaxRequestsPerChild 0, , , , Apache . User Group UID GID , httpd . httpd , root , 80 , Web . UID GID , apache2.conf. UID GID - Web . GNU/Linux www-data www-data. www-data ID ID httpd. GID GID Web , , . 2.2.1.8. KeepAlive

. , , . HTTP TCP, HTTP TCP . , . , , . , . KeepAliveTimeout , , . MaxKeepAliveRequests: , keep-alive , TCP . Apache 100. MaxKeepAliveRequests 0 . 100 , , . , 100 , . . Timeout : . , . , , . BrowserMatch: . BrowserMatch: BrowserMatch Mozilla/2 nokeepalive BrowserMatch MSIE 4\.0b2 nokeepalive downgrade-1.0 force-response-1.0 BrowserMatch RealPlayer 4\.0 force-response-1.0 BrowserMatch Java/1\.0 force-response-1.0 BrowserMatch JDK/1\.0 force-response-1.0 BrowserMatch , Web . HTTP 1.0, HTTP 1.1. BrowserMatch downgrade-1.0 , HTTP 1.0, . - keep-alive . HTTP 1.0 , , HTTP 1.0.

2.2.1.9. . Web . , Web . , Web . Web , , , WAN Web . , : ProxyRequests: on Web .. off. ProxyVia: Via: . CacheRoot: , Wev . www-data, httpd. CacheSize: . 5KB, . 100 MB - . CacheGcInterval : , . 4. 5 . CacheMaxExpire : , . 24 . . CacheLastModifiedFactor : . 0.1. , , 10 , . , , .

, , . , - CacheMaxExpire. CacheDefaultExpire : , . . NoCache : , . , , , . NoCache, , .

2.2.2. Apache 2.2.2.1. mod_php mod_php - Apache *.php . PHP mod_php PHP. PHP , . PHP HTML . HTML , . PHP 1994 ., - . - , . 2002 PHP 9 , . http://www.php.net/usage.php - , PHP 20,917,850 , 1,224,183 IP :

: 2.2 PHP . , - , , . PHP Personal Home Page, Gnu ( Gnu = Gnu's not Unix ) PHP hypertext Preprocessor. PHP http://www.php.net Apache, () ( source ). mod_php PHP : http://www.php.net 2.2.2.1.1 PHP PHP / : tar zxvf php_XX.tar.gz PHP Makefile : ./configure \ --with-apxs2=/usr/local/apache/bin/apxs \ --with-mysql \ --prefix=/usr/local/apache/php \ --with-config-file-path=/usr/local/apache/php \

--enable-force-cgi-redirect \ --with-zlib \ --with-gettext \ --with-gdbm - with-apxs2 prefix. with-mysql MySQL , --with-config-file php.ini, --with-zlib gzip-type , --with-gettext with-gdbm GDBM . Makefile : make. make, , make install: make install PHP , PHP: cp -p php.ini-recommended /usr/local/apache/php/php.ini Apache /etc/apache2/apache2.conf: # Use for PHP 5.x: LoadModule php5_module AddHandler php5-script php modules/libphp5.so

# Add index.php to your DirectoryIndex line: DirectoryIndex index.html index.php AddType text/html php

# PHP Syntax Coloring # (optional but useful for reading PHP source for debugging): AddType application/x-httpd-php-source phps PHP Apache PHP : apache2ctl restart 2.2.2.1.2 PHP PHP

2.2.2.1.2.1 PHP DEB DEB Debian Uduntu. : dpkg i php_x.deb 2.2.2.1.2.2 PHP RPM RPM RedHat Fedora. : rpm ivh php_x.rpm 2.2.2.1.3 PHP 2.2.2.1.3.1 PHP apt apt-get GNU/Linux apt(Advanced Packaging Tool). APT : Debian, RedHat, Fedora, Knoppix . PHP mod_php apt : apt-get install php5 libapache2-mod-php5 2.2.2.1.3.2 PHP yum GNU/Linux yum. Yum : RedHat, Fedora . PHP mod_php yum : yum install php 2.2.2.2. mod_perl mod_perl, Perl. Perl ( "", Practical Extraction and Report Language) , , 1987 . , , Perl.

mod_perl Perl . mod_perl http://perl.apache.org/ 2.2.2.2.1. mod_perl mod_perl 2.2.2.2.1.1. mod_perl DEB DEB Debian Uduntu. : dpkg i mod_perl_x.deb 2.2.2.2.1.2. mod_perl RPM RPM RedHat Fedora. : rpm ivh mod_perl_x.rpm 2.2.2.2.2. mod_perl 2.2.2.2.2.1 mod_perl apt apt-get GNU/Linux apt(Advanced Packaging Tool). APT : Debian, RedHat, Fedora, Knoppix . Perl mod_php apt : apt-get install libapache2-mod-perl2 2.2.2.2.2.2 mod_perl yum GNU/Linux yum. Yum : RedHat, Fedora . Perl mod_perl yum : yum install mod_perl 2.2.2.3. mod_python mod_python, Python.

(. Python, ) , , - , 90- . BBC Monty Pythons Flying Circus. Tcl, Perl, Scheme, Java Ruby. . , , C. , . , . , / (I/O), , (sockets), GUI- , . , , , (linking) . , Java, , , ( ). , , , - , C/C++. , : * - . * , ( , , Haskell). * . mod_python Python . mod_python http:// www.modpython.org/ 2.2.2.3.1. mod_python mod_python 2.2.2.3.1.1. mod_python DEB DEB Debian Uduntu. : dpkg i mod_python_x.deb

2.2.2.3.1.2. mod_python RPM RPM RedHat Fedora. : rpm ivh mod_python_x.rpm 2.2.2.3.2. mod_python 2.2.2.3.2.1 mod_python apt apt-get GNU/Linux apt(Advanced Packaging Tool). APT : Debian, RedHat, Fedora, Knoppix . Python mod_python apt : apt-get install libapache2-mod-python 2.2.2.3.2.2. mod_python yum GNU/Linux yum. Yum : RedHat, Fedora . Python mod_python yum : yum install mod_pytnon 2.2.2.4. mod_cband mod_cband Apache 2 ( mod_bandwidth) , , ( mod_limitipconn), ( mod_curb) . mod_cband Lukasz Dembinski, Sergey V. Beduev, Kyle Poulter, J. Kendzorra Adam Dawidowski. GNU GPL . mod_cband - (: 5 GB 1 .) 2.2.2.4.1. mod_cband 4.0 (Etch) : apt-get install libapache2-mod-cband mod_cband. yes mod_cband

Apache, No . 2.2.2.4.2. mod_cband : > kbps, Mbps, Gbps - " ", : 1024, 1024*1024 1024*1024*1024 > kb/s, Mb/s, Gb/s - " ", : 1024, 1024*1024 and 1024*1024*1024 > kbps > K, M, G - , : 1000, 1000*1000 and 1000*1000*1000 . > Ki, Mi, Gi - , : 11024, 1024*1024 and 1024*1024*1024 . > > S, M, H, D, W : , , , , ; : 1, 60, 3600, 86400, 604800 > S : CBandDefaultExceededURL : URL mod_cband . : Server config : CBandDefaultExceededURL URL : CbandDefaultExceededURL www.dhstudio.eu/exceeded.html : CbandDefaultExceededCode : HTTP : Server config :CBandDefaultExceededCode HTTP_CODE : CBandDefaultExceededCode 509

: CBandScoreFlushPeriod : . mod_cband : 1 : Server config : CBandScoreFlushPeriod __ : CBandScoreFlushPeriod 100 100 : CBandSpeed : : : CBandSpeed kbps rps max_conn kbps- [kMG]bps [kMG]B/s rps- max_conn- : CBandSpeed 1024 10 30 1024kbps, 10 30 . : 0.9.6.0 : CBandRemoteSpeed : : : CBandRemoteSpeed kbps rps max_conn kbps- [kMG]bps [kMG]B/s rps- max_conn- : CBandRemoteSpeed 20kb/s 3 3 20kB/s, 3 3 . : 0.9.6.1-rc2 : CBandClassRemoteSpeed : . :

: CBandClassRemoteSpeed class_name kbps rps class_name- kbps- kbps kB/s rps- max_conn- : CBandClassDst 66.249.64/24 CBandClassDst 66.249.65/24 CBandClassDst 66.249.79/24 CBandClassRemoteSpeed googlebot_class 20kb/s 2 3 20kB/s, 2 3 googlebot_class. : 0.9.6.1-rc2 : CBandRandomPulse : . mod_cband. : Global : CBandRandomPulse On/Off : CBandLimit : : : CBandLimit limit limit- , : K (kilo), M (mega), G (giga), Ki (kibi), Mi (mebi), Gi (gibi) : CBandLimit 10M 10 * 1000 * 1000 bytes CBandLimit 10Mi 10 * 1024 * 1024 bytes : , G 0.9.6.0. .

: CBandClassLimit : : : CBandClassLimit class_name limit class_name- limit- , : K (kilo), M (mega), G (giga), Ki (kibi), Mi (mebi), Gi (gibi) : , G 0.9.6.0. . : CBandExceededURL : URL mod_cband . URL http 503 (Service Unavailable) : : CBandExceededURL URL : CbandDefaultExceededURL www.dhstudio.eu/exceeded.html : CBandExceededSpeed : . : : CBandExceededSpeed kbps rps max_conn kbps- kbps kB/s rps- max_conn- : 0.9.6.0 : CBandScoreboard : : : CBandScoreboard path

: apache : CBandPeriod : . : : CBandPeriod period period : S (seconds), M (minutes), H (hours), D (days), W (weeks) : CBandPeriod 1W CBandPeriod 14D CBandPeriod 60M : CBandPeriodSlice : : slice_len = limit : slice_len = limit : CBandPeriodSlice slice_length : CBandLimit 100G CBandPeriod 4W CBandPeriodSlice 1W 4 (4W/1W=4). 100G/4=25G . 50G, 75W .. : : cband : Server config : : CBandUserSpeed : cband : : CBandUserSpeed kbps rps max_conn kbps- kbps kB/s rps- max_conn- : CBandUserSpeed 100kb/s 10 5

100kB/s, 10 5 . : 0.9.6.0 : CBandUserLimit : cband : : CBandUserLimit limit limit- , : K (kilo), M (mega), G (giga), Ki (kibi), Mi (mebi), Gi (gibi) : CBandUserLimit 10M 10 * 1000 * 1000 bytes CBandUserLimit 10Mi 10 * 1024 * 1024 bytes : , G 0.9.6.0. . : CBandUserClassLimit : cband : : CBandUserClassLimit class_name limit class_name- limit- , : K (kilo), M (mega), G (giga), Ki (kibi), Mi (mebi), Gi (gibi) : , G 0.9.6.0. . : CBandUserExceededURL : URL mod_cband . URL http 503 (Service Unavailable) : : CBandUserExceededURL URL

: CBandUserExceededSpeed : . CBandUserExceededURL. : : CBandUserExceededSpeed kbps rps max_conn kbps- kbps kB/s rps- max_conn- : 0.9.6.0 : CBandUserScoreboard : : : CBandUserScoreboard path : apache : CBandUserPeriod : Specifies a period after which a user's usages are cleared : : CBandUserPeriod period period : S (seconds), M (minutes), H (hours), D (days), W (weeks) : CBandUserPeriod 1W CBandUserPeriod 14D CBandUserPeriod 60M : CBandUserPeriodSlice : Specifies a period slice length : slice_len = limit : : CBandUserPeriodSlice slice_length : CBandUserLimit 100G CBandUserPeriod 4W CBandUserPeriodSlice 1W 4 (4W/1W=4).

100G/4=25G . 50G, 75W .. 2.2.2.4.3 mod_cband - # CBandClassDst 172.16.0.0/16 CBandClassDst 192.168.0.0/16 ServerName dhstudio.eu ServerAlias www.dhstudio.eu DocumentRoot /var/www/ ErrorLog /var/www/error.log LogLevel warn CustomLog /var/www/access.log combined Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all # 1024 kbps # 10 # 30 CBandSpeed 1024 10 30 # 20kb/s, 2 , 3 local_traffic CBandClassRemoteSpeed local_traffic 20kb/s 2 3 :

. ServerName. - CBandDefaultExceededURL http://www.dhstudio.eu/bandwidth_exceeded.html ServerName dhstudio.eu ServerAlias www.dhstudio.eu DocumentRoot /var/www/ ErrorLog /var/www/error.log LogLevel warn CustomLog /var/www/access.log combined Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all # 100 MB CBandLimit 100000 # http://www.dhstudio.eu/bandwidth_exceeded.html CBandExceededURL http://abc.org/bandwidth_exceeded.html # CBandScoreboard /var/www/cband/dhstudio.scoreboard # (30 ) #( >=0.9.5-rc2) CBandPeriod 30M : . ServerName. 2.2.2.4.4 mod_cband

mod_cband(/etc/apache2/mods-enabled/cband.conf) : SetHandler cband-status SetHandler cband-status-me : http://www.site_cband.com/cband-status http://www.site_cband.com/cband-status-me XML : http://www.site_cband.com/cband-status?xml http://www.site_cband.com/cband-status-me?xml . : : /etc/apache2/mods-enabled/cband.conf Order allow,deny Allow from all SetHandler cband-status AuthType basic AuthName "Cband Authentication" Require valid-user AuthUserFile /var/www/.htpasswd SetHandler cband-status-me

mod_cband : htpasswd -c /var/www/.htpasswd cband mod_cband , . - , . 2.3. Web Apache Web . , (denial of service -DOS), Web , . Apache. 2.3.1 . . Options . Options Directory . : Options FollowSymLinks AllowOverride None Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all Options Indexes MultiViews AllowOverride None Order allow,deny

Allow from all AllowOverride None Options None Order allow,deny Allow from all Order deny,allow Deny from all Allow from localhost Options Indexes FollowSymLinks : (/) /var/www/, /var/www/icons, /var/www/cgi-bin /usr/share/doc . Options: FollowSymLinks, Indexes, None MultiView. Options : All ExecCGI CGI . ExecCGI CGI , , ScriptAlias. FollowSymLinks . , . Includes Server Side Includes (SSI) IncludeNOEXEC Server Side Includes (SSI), #exec #include Indexes , index.html MultiViews . None . - .

SymLinksIfOwnerMatch , , , , AllowOverride. , . Options AllowOverride , Directory Order, Allow Deny. . : Order , . order deny,allow apache Deny Allow. Deny from , Web , . , IP . all . Allow from , . IP . , . all . 2.3.2 AccessFileName .htaccess apache2.conf(/etc/apache2/apache2.conf) , .htaccess. , , , , AllowOverride. .htaccess Directory. - , Directory , .htaccess , . .htaccess , apache2.conf, . AllowOverride , , .htaccess:

None . None .htaccess All .htaccess , Apache, . : AuthConfig, FileInfo, Indexes Limit AuthConfig .htaccess . FileInfo , . Indexes .htaccess . Limit . , AllowOverride . : AllowOverride AddType Options AllowOverride , . 2.3.3 iptables IPTABLES GNU/Linux. netfilter GNU/Linux, iptables ipchains. 2 , iptables .

2.4. Apache

Apache -( Log Files ). ErrorLog . LogLevel . LogLevel : debug, info, notice, warn, error, crit, alert emerg. . debug . warn , , , . Debug . Emerg . warn . TransferLog , httpd . , . LogFormat -. , , CustomLog. - Apache Common Log Format (CLF). CLF , Web . , , Apache, , . CLF LogFormat : LogFormat %h %l %u %t \%r\ %>s %b common CLF , LogFormat: %h IP . HostnameLookups on, . HostnameLookups (off) . %l , . identd. identd , - . %u , Web

, . , . %t %r , URL . \ . %>s . , . > , - . %b . LogFormat . common . , LogFormat CustomLog. : LogFormat %h %l %u %t \%r\ %>s %b \%{Referer}i\ \%{User-Agent}i\ combined Apache . User-Agent %{User-Agent}i . i , . o . User-Agent , . Referer , Web . Apache , . , , , . : 202: OK 302: Found 304: Not Modified 400: Bad Request 401: Unauthorized 403: Forbidden 404: Not Found 500: Server Error 503: Out of Resources (Service Unavailable)

. 501: Not Implemented 502: Bad Gateway (gateway) LogFormat. , Apache. Not Implemented ( 501 ) User-Agent : %501{User-Agent}i LogFormat, 501. ! ( ! not. !: %!200,302,304{Referer}i , Web . , .

Web . GNU/Linux Web Apache. Apache Web . GNU/Linux Web . Apache - Apache License. GNU GPL, GPL 3 (7), , Apache.