How to install apache server
. How to make configuration changes to Apache
. Where Apache log and configuration files are stored
On Windows, you can signal Apache using the httpd.exe executable. Some commands
are listed here:
. httpd.exe -k graceful—Tells Apache to do a graceful restart
. httpd.exe -k stop—Tells Apache to stop
. httpd.exe -k restart—Tells Apache to restart

Apache Configuration File Structure
nice things to remember that apache has all its configuration information in text files. The main file is httpd.conf. This file contains directives and containers that enable you to customize
your Apache installation. Directives configure specific settings of Apache,
such as authorization, performance, and network parameters. Containers specify the
context to which those settings refer. For example, authorization configuration can
refer to the server as a whole, to a directory, or to a single file.
The following rules apply for Apache directive syntax:
. The directive arguments follow the directive name.
. The directive arguments are separated by spaces.
. The number and type of arguments vary from directive to directive; some
have no arguments.
. A directive occupies a single line, but you can continue it on a different line
by ending the previous line with a backslash character (\).
. The pound sign (#) should precede the directive, and must appear on its
own line.
The Apache documentation for directives typically follows this model:
. Description—This entry provides a brief description of the directive.
. Syntax—This entry explains the format of the directive options. Compulsory
parameters appear in italics, and optional parameters appear in italics and
. Default—If the directive has a default value, it appears here.
. Context—This entry details the containers or sections in which the directive
can appear. The next section explains containers. The possible values are
server config, virtual host, directory, and .htaccess.
. Override—Apache directives belong to different categories. The Override field
specifies which directive categories can appear in .htaccess per-directory
configuration files.
. Status—This entry indicates whether the directive is built in Apache (core),
belongs to one of the bundled modules (base or extension, depending on
whether they are compiled by default), is part of a multiprocessing module
(MPM), or is bundled with Apache but not ready for use in a production server
. Module—This entry indicates the module to which the directive belongs.
. Compatibility—This entry contains information about which versions of
Apache support the directive.

Directive containers, also called sections, limit the scope for which directives apply. If
directives are not inside a container, they belong to the default server scope (server
config) and apply to the server as a whole.
These are the default Apache directive containers:
. <VirtualHost>—A VirtualHost directive specifies a virtual server. Apache
enables you to host different websites with a single Apache installation.
Directives inside this container apply to a particular website. This directive
accepts a domain name or IP address and an optional port as arguments. You
learn more about virtual hosts in Chapter 29, “Apache Performance Tuning
and Virtual Hosting.”
. <Directory>, <DirectoryMatch>—These containers allow directives to apply
to a certain directory or group of directories in the filesystem. Directory containers
take a directory or directory pattern argument. Enclosed directives
apply to the specified directories and their subdirectories. The DirectoryMatch
container allows regular expression patterns to be specified as an argument.
For example, the following allows a match of all second-level subdirectories of
the www directory and made up of four numbers, such as a directory named
after a year and month (0212 for February 2012):
<DirectoryMatch “^/www/.*/[0-9]{4}”>
. <Location>, <LocationMatch>—These containers allow directives to apply to
certain requested URLs or URL patterns. They are similar to their Directory
counterparts. LocationMatch takes a regular expression as an argument. For
example, the following matches directories containing either “/my/data” or
<LocationMatch “/(my|your)/data”>
. <Files>, <FilesMatch>—Similar to the Directory and Location containers,
Files sections allow directives to apply to certain files or file patterns.
Conditional Evaluation
Apache provides support for conditional containers. Directives enclosed in these containers
are processed only if certain conditions are met:
. <IfDefine>—Directives in this container are processed if a specific commandline
switch is passed to the Apache executable. The directive in Listing 3.2 is
processed only if the -DMyModule switch is 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 chapter.
IfDefine containers also allow you to negate the argument. That is, directives
inside a <IfDefine !MyModule> section—notice the exclamation point before
the MyModule name—are processed only if no -DMyModule parameter is passed
as a command-line argument.
<IfModule>—Directives in an IfModule section are 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.

IfDefine Example
1: <IfDefine MyModule>
2: LoadModule my_module modules/
3: </IfDefine>

<IfModule prefork.c>
2: StartServers 5
3: MinSpareServers 5
4: MaxSpareServers 10
5: MaxClients 20
6: MaxRequestsPerChild 0
7: </IfModule>
9: <IfModule worker.c>
10: StartServers 3
11: MaxClients 8
12: MinSpareThreads 5
13: MaxSpareThreads 10
14: ThreadsPerChild 25
15: MaxRequestsPerChild 0
16: </IfModule>

Apache directives belong to different groups, as specified in the
Override field in the directive syntax description. Possible values for the Override
field are as follows:
. AuthConfig—Directives controlling authorization
. FileInfo—Directives controlling document types
. Indexes—Directives controlling directory indexing
. Limit—Directives controlling host access
. Options—Directives controlling specific directory features

Some httpd Options
Option Meaning
-D Allows you to pass a parameter that can be used for <IfDefine> section processing
-l Lists compiled-in modules
-v Shows version number and server compilation time
-f Allows you to pass the location of httpd.conf if it differs from the compile-time default

How to install apache server