Russian description of configuration file.


   :

 [   ,    ]

 Server server1
   [    ]

 Alias /server_path1 local_path1
   [   N1 ]
   ....

 Alias /server_path2 local_path2
   [   N2 ]

 Server server2
   [    ]

     : , 
 ,  .   ,
     (Server)  
 (Alias).


        
   :
 Mime text/plain;\ charset=windows-1251 txt
    ___:
 Mime "text/plain; charset=windows-1251" txt

       ,  
     :
 Server site.ru www1.site.ru \
        www2.site.ru



       :
  b - 
  k  K -  (1024 )
  M -  (1024 )
    ,  

       :
  s - 
  m - 
  h - 
  d - 
  W - 
  M -  (30 )
  Y -  (365 )
    ,  

       :
  on, yes, true -  
  off, no, false -  


-------------------------------------------------------------------






+------------------------------------------------------------------
|    Listen

  ,   ;    , 
  .     
Listen.

:
Listen 80
Listen 8080
Listen 11.22.33.44:80
Listen 11.22.33.44 80



+------------------------------------------------------------------
|    Connections

   ,
     503

Connections 1000


+------------------------------------------------------------------
|    ProxyConnections

    backend-
(   backend')

ProxyConnections 100


+------------------------------------------------------------------
|    ConnectionsPerIP

     
IP (    DoS-   
    IP)

ConnectionsPerIP 50


+------------------------------------------------------------------
|    Timeout

   -  .

Timeout 60


+------------------------------------------------------------------
|    KeepAliveTimeout

     
 ,      
 keep-alive .

KeepAliveTimeout 10


+------------------------------------------------------------------
|    MaxBuffer

  ,   
  backend.

   ,  0W-httpd  
backend'      ,   
  0W-httpd -  .   
 ,  0W-httpd     
backend',      .

MaxBuffer 128k


+------------------------------------------------------------------
|    MaxPostSize

    POST-.

  POST- 0W-httpd  
       
  backend.

MaxPostSize 256k


+------------------------------------------------------------------
|    LowWatermark

 Low Watermark (  FreeBSD)

    LowWatermark, 
   0W-httpd    
 ,     
LowWatermark .   
  SendBuffer,  LowWatermark 
,  SendBuffer.    
   0W-httpd,      ,
  0W-httpd.

   .

:
LowWatermark 120k
SendBuffer 128k


+------------------------------------------------------------------
|    SendBuffer

   .

     . 
      , 
 0W-httpd

:
SendBuffer 128k


+------------------------------------------------------------------
|    DetachRoot

  root'   .

 ,  0W-httpd   80 , 
  root.   0W-httpd  
root'.     
 (chown user:group 0W-httpd)   
suid-bit (chmod +s 0W-httpd,    
 "make install"),  0W-httpd    
(  UID)    
.   UID    root',
   remote-exploit  
root'   .  ,  0W-httpd  
       
   ,   ,
 DetachRoot    (  ).

       ( 1024)
 .   ,   
  Listen   0W-httpd  USR1 - 
,     : HUP.   
 DetachRoot   0W-httpd   
(0W-httpd -w),      0W-httpd


DetachRoot on


+------------------------------------------------------------------
|    ServerTokens

     0W-httpd   Server http-.
:
 off  -    Server
 name -  "Server: 0W"
 on   - : "Server: 0W/"

ServerTokens on


+------------------------------------------------------------------
|    Expires

  Expires.

 :

 past -  expires   (1 )  
        http-,   
        (Pragma: no-cache, Cache-control: no-cache);
 future -  expires   (1 );
 [] -  expires   
           .

(       
)

:
Expires 7d  - expires  7   
Expires -1M - expires  1   


+------------------------------------------------------------------
|    Reverse

  ,    
   .    ,
      
 .    .

:
Reverse ext1 ext2 ...

(       
)

:
  
 Reverse mp3 avi mpg mpeg asf wmv mov
    http://server.name/file.mp3
    http://server.name/file.3pm
 0W-httpd   file.mp3


+------------------------------------------------------------------
|    KeepAlive

/     
 (  ,   , 
      ,   ,
      
KeepAliveTimeout ).

(       
)

KeepAlive on


+------------------------------------------------------------------
|    Log

   (access.log):
on -   
errors -   ,   (status >= 400)
off -   

(       
)

Log on


+------------------------------------------------------------------
|    SkipWWW

  www.    .
 ,     
    www. (  ,
     c )

SkipWWW off


+------------------------------------------------------------------
|    SkipPort

     ;
 ,  www.site.com  www.site.com:8080
     
   www.site.com

    off,   
       : 
www.site.com  www.site.com:8080
( 80  )

(    ,    ,
   off     )

SkipPort on


+------------------------------------------------------------------
|    Listing

    ,    
  (   1024 )
(       
)

:
 off -  
 on - 
 simple -    (  
           ͣ ,      )

Listing off


+------------------------------------------------------------------
|    Admin

Email ,   ,    
  ,   (  ,
   ..)

:
Admin webmaster@site.ru


+------------------------------------------------------------------
|    FilesCheck

    0W-httpd   
.       
  .    ,   
,           
.        ,
   ,   
FilesCheck.    ,   .

FilesCheck 30s


+------------------------------------------------------------------
|    FilesKeep

   ,  ,
0W-httpd    ,    ,
  FilesKeep

FilesKeep 10s


+------------------------------------------------------------------
|    Index

  ,     ,
   /dir/index.html  /dir/ ; 
       .

:
Index index.html index.htm

    (     
index.html  index.htm,    index.html)


+------------------------------------------------------------------
|    Access

  

     :

Access ["deny"|"allow"] what [> redirect] [[,] ["deny"|"allow"] what] ...

    (  ,   
   Access),      
,    Access  
 (  -  ,  
 -  Access),    Access
,   .

    Access,    
    (  ), 
    ,    .


what -    :
 1) *  - 
 2) CC -  CC -     ( 
        IP-,   conf    
         IP- )
 3) XX.XX.XX.XX - IP 
 4) 192.168.0.0/16
    192.168.*
    192.168.         -     IP-
 5) User:conf/passwd -   , User -  
               (realm), conf/passwd -   
             ,    ,  realm 
             ,      :
             Site\ admin:/etc/httpd/passwd
 6) referrer=value   -     referrer
              :
             self:   ,    
             foreign: referrer    ,    
             empty:   referrer
             server:   

 > redirect -   403 (Forbidden)   (302)
                .   
              1)  http://,      URL,
              2)   (/),     
                      .
              3)    
                   (Alias)
              (  '>' )
                   
              ,    ,
                   .

:

      :
 Access deny *, allow ru, allow ua


      allow 
deny,    (allow|deny)   
 ,    :
  Access deny *, allow ru ua


  ,     403 (Forbidden), 
    http://server-name/restricted.html
  Access deny * > /restricted.html, allow ru ua


      site.ru
 site.org     :
  Server site.ru
  Alias / /site/
  Access deny > http://site.org/, allow ru

    ,  
    ,  ,  :
http://site.ru/dir/page.html  
http://site.org/dir/page.html


    referrer'   webwarper.net
    ( referrer    ,
  URL,   ۣ):
  Access deny referrer=foreign, allow referrer=webwarper.net


      IP 
   :

  Access allow Site\ admin:conf/passwd, allow 217.16.19.218

(     ,   
   :  
 ,   )


   site.ru     - 
( 192.168.*  10.*),    /pub/  :

  Server site.ru
  Access deny *, allow 192.168.* 10.*
    Alias /pub/ /web/pub
    Access allow *



+------------------------------------------------------------------
|    Trusted

 "" ,    
     (Antiflood 
 ConnectionsPerIP),

     IP  
X-Real-IP,      
,       X-Real-IP 
.

    Trusted- 
        
 .

: Trusted [net|IP] [net|IP] ...


+------------------------------------------------------------------
|    Antiflood

  http- (     IP).
   ,    . 

    :   
   ,    
     /  
   .


: Antiflood requests=R [per=P] [deny=D] [on|off]

 R -     
      0 -  ,   - 0.
 P -    [ - 30 ].
 D - ,      ,
        IP    R 
       P [ - 60 ].
 
  on  off ( : off) , 
    .     
 ,        , 
    /    
  "Antiflood off".

      ,   
        "Antiflood on"

:
 Antiflood requests=5000 per=30m deny=1h off

 Server one.ru
 .....

 Server two.ru
 Antiflood on
 ...

     5000   30 ,
  ,     1 , 
  ,     one.ru
 ,    two.ru   
 ,    . 

       ,
    ,   .


+------------------------------------------------------------------
|   Cache    Cached

   . 

       
  ,      200
(OK),       , 
       ( 
HTTP-),      
: Last-Modified, Expires, Content-type,
Content-Encoding,    ( 
   ,      -
).


     ,  
      , 
       
    .

 :
 Cache [] []
   ""      ,
      ,   "default".

 ,  :

  size= -     , 
                     
                ,    
                 [: 128M]

  max=  -    [: 128k]

  age=    - ,     
                  ,      [1h]

  minAge= -      , 
                    
                    [5m]

  SkipQuery   -      
                  ;   site.ru/test?qwe
                    ,   
                site.ru/test,       [off]

  SkipHost    -    
                    ,  
                   [off]

  OnFault     -   ,    
                   ,    
                    .


      :
1)     ,    
      ;
2)     ,    ;
3)   ,    Expires;
4)      
   ( MSIE: Ctrl-F5)


 . 

        ,
   html-:


Cache images size=600M age=4h  max=100k SkipQuery
Cache css    size=16M  age=12h max=20k  SkipQuery
Cache pages  size=128M age=1h

  "images"  600b,     - 4
,      - 100kb, 
    (query string).

  "css"  10Mb,   - 12 ,
   - 20kb,  
  .

  "pages"  128Mb,   - 1 ,
     .


      :

Server site.ru

#       :
Alias / /www/site

Alias /|text/html,text/plain localhost:80
Cached pages

Alias /|image /www/site
Cached images

Alias /|text/css /www/site
Cached css

 ,     
 ,      ,
       , 
        ,  
       
.


       ,
  cache[=],    
,        128kb.

:
http://site.ru/status?cache
http://site.ru/status?cache=/images


   :

      Trusted-  
     cache-delete[=]
    , -   
 "",    ,   .

: http://site.ru/status?cache-delete=/css

- -   ,     
   /status?cache
   SkipHost,     
,   ,     , 
 http://

  trusted-   
   ,    :

Cache-Control: no-cache
(     
  Ctrl-F5  MSIE, Ctrl-Shift-R  Firefox)

    ,  :
Cache-Control: no-store

       204 "no content",
   .

        trusted-,  
    ( )    
,       MinAge .


+------------------------------------------------------------------
|    ErrorPages

     , 
      
 .       
  ( ),     ,
      %d   .
    ,     
    40x  50x.

:
ErrorPages /path/to/site/errors/%d.html 403 404 503


+------------------------------------------------------------------
|    Throttle

  ,    
  . 

      . 
     (   
   ,    32-128kb),
     . 
  ,     
,   5- , 
        ,
 4     .   
    ( 0.5-1Mb),   __
 .

 (   3Mbyte/sec): 
Throttle 3M



+------------------------------------------------------------------
|    Mime

    .

    (tar.gz  )

  mime-    `*' 
   . (    
- httpd.conf)

Mime text/plain;\ charset=windows-1251 *
Mime application/octet-stream gz tgz exe
Mime application/x-shockwave-flash swf
Mime application/zip zip
Mime video/x-msvideo avi
Mime audio/mpeg mp3
Mime text/css css
Mime text/plain;\ charset=windows-1251 txt
Mime text/html;\ charset=windows-1251 html htm
Mime image/jpeg jpg jpeg
Mime image/gif gif

       
,  , ,   
    , , 
    cp1251:

Mime text/html;\ charset=windows-1251 html htm
...
     int.com   utf-8:
Server int.com
Mime text/html;\ charset=utf-8 html htm
...



+------------------------------------------------------------------
|    Server

  :

Server name [name1 name2 ...]
(name1, name2 -   )


   "*"   ,  
     ,   "*"


   patterns  
  : * -   
, ? -  , [abcd] -   .
: *.site.ru


      (Alias),   
     404 (not found)



  Server    Alias  
  ,     
      (Alias). 
 :
Admin, Log, Index, KeepAlive, Listing, Filter, 
Access, Expires, Reverse



+------------------------------------------------------------------
|    Alias


  :
Alias /server_path local_path

     .


localpath    :

1)     (    "/"):

Alias / /usr/local/apache/data


2) http- (   http://):
     ( 301, Moved Permanently)
   http://server/old_stuff/123.html -> http://old.name/off.html?/123.html

Alias /old_stuff/ http://old.name/off.html?


3) backend-: IP:PORT/path  hostname:PORT/path

   0W-httpd    - (frontend, accelerator)
      backend',  
        (  hostname
      IP).
    IP     X-Real-IP;  
   backend  Apache 1.3.x,       mod_realip
   (ftp://ftp.lexa.ru/pub/apache-rus/contrib/mod_realip-1.0.tar.gz)

Alias / localhost:80
Alias / host1.site.ru:8080 host2.site.ru:8080 host3.site.ru:8080


4) -: STATUS, EMPTY, PIXEL, STORAGE

    STATUS:    

Alias /status STATUS


    EMPTY:       ,
    content-type      .
       

Alias /dummy EMPTY 


    PIXEL:  gif- 1x1 ( gif)

Alias /p.gif PIXEL
           , 
    :   http://server.name/p.gif?0000FF  
      


    PIXEL RRGGBB:  gif- 1x1  
Alias /blue.gif PIXEL 0000FF


    STORAGE:   ,   
          
    .

     .

,     -  
 (, ,   ..),    , 
    ,  ,  
       
.        
 (,     site.ru,   
 /home/site/web)

1)     : 
   /home/site/web/files
2) ,     (sym-links)   :
   /home/site/web/storage
3) - ,     :
   http://site.ru/file.php

,      cool_music.mp3, 
     /home/site/web/files/2005/04/04/123.mp3
        
 http://site.ru/file.php?id=123

   :
1)    symlink   storage  -
 ,      :
  symlink("../files/2005/04/04/123.mp3", "storage/123da71ee");
  (    storage)

2)      :
  http://site.ru/storage/123da71ee/cool_music.mp3


 -  (,  2 )   ,
,  :
*/30 * * * * cd web/storage && find . -type l -mmin +120 | xargs -r rm

  :
Alias /storage STORAGE /home/site/web/storage

     ,   /files :
Alias /files /home/site/web/files
Access deny *


  server_path   -,
  server_path:

 `$'    

, ,     
:

Alias / /usr/local/apache/data
Alias /$ http://rip.site/we-are-down.html
Alias /index.html$ http://rip.site/we-are-down.html



 `|'     . 

       Mime  ,
     . 
    .

:
        Expires
    ,    
:

Alias / /home/site/web
Alias /|text/html,text/plain localhost:80
Alias /|image /home/site/web
Expires future



 `*'      (,
),     
 (   )


:   ,  
  backend:

Alias / localhost:80
Alias /*.gif,.jpg,.png /usr/local/apache/data
  `*'   ,   :
Alias /*.gif,*.jpg,*.png /usr/local/apache/data

 :  ,  html'   
  backend,  - 
Alias / /usr/local/apache/data
Alias /*.html,.htm,/ localhost:80


-------------------------------------------------------------------

  local_path   - `$',
       Alias' 
   local_path
:
         : 
Alias /*/favicon.ico  /home/site/web/favicon.ico$



-------------------------------------------------------------------

  Alias    , 
      
 : Log, Index, KeepAlive, Listing, Access,
Expires, Reverse.


:
Server www.dot.com dot.com
Alias / /usr/local/apache/dot/data
Alias /cgi-bin localhost:80/cgi-bin
KeepAlive off
Log on
(     /cgi-bin)

