Page 48 - Open Soource Technologies 304.indd
P. 48

Unit 4: Apache Server Installation in Window



               6.  SomeDirective3                                                                 Notes
               7.  </Location>

               8.  <Files “\.(gif|jpg)”>

               9.  SomeDirective4
              10.  </Files>

            Sample directives SomeDirective1 and SomeDirective2 will apply to the directory/www/docs and
            its subdirectories. SomeDirective3 will apply to URLs referring to pages with the .html extension
            under the/download/URL. SomeDirective4 will apply to all files with .gif or .jpg extensions.

            4.2.3 Conditional Evaluation

            Apache provides support for conditional containers. Directives enclosed in these containers will
            be processed only if certain conditions are met.
               •  <IfDefine>? Directives in this container will be processed if a specific command line switch
                 is passed to the Apache executable. The directive in Listing 2 will be processed only if
                 the DMyModule switch was passed to the Apache binary being executed. You can pass
                 this directly or by modifying the apachectl script, as described in the “Apache-Related
                 Commands” section later in this hour.

                 If  Define  containers  allow  the  argument  to  be  negated.  That  is,  directives  inside  a
                 <IfDefine !MyModule>section will be processed only if no -DMyModule parameter was
                 passed as a command-line argument. For example, if DSSL is not passed, listening on the
                 SSL port (usually 443) will not occur.
               •  <IfModule>?  Directives  in  an  IfModule  section  will  be  processed  only  if  the  module
                 passed as an argument is present in the Web server. For example, Apache ships with a
                 default httpd.conf configuration file that provides support for different MPMs. Only the
                 configuration belonging to the MPM compiled in will be processed, as you can see in
                 Listing 3. The purpose of the example is to illustrate that only one of the directive groups
                 will be evaluated.

            Listing 2 IfDefine Example
               1.  <IfDefine MyModule>

               2.  LoadModule my_module modules/libmymodule.so
               3.  </IfDefine>

            Listing 3 IfModule Example
               1.  <IfModule prefork.c>

               2.  StartServers   5
               3.  MinSpareServers   5

               4.  MaxSpareServers   10

               5.  MaxClients    20




                                             LOVELY PROFESSIONAL UNIVERSITY                                    43
   43   44   45   46   47   48   49   50   51   52   53