Blame docs/manual/configuring.html.en

Packit 90a5c9
Packit 90a5c9
Packit 90a5c9
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
Packit 90a5c9
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
Packit 90a5c9
Packit 90a5c9
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Packit 90a5c9
              This file is generated from xml source: DO NOT EDIT
Packit 90a5c9
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Packit 90a5c9
      -->
Packit 90a5c9
<title>Configuration Files - Apache HTTP Server Version 2.4</title>
Packit 90a5c9
<link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
Packit 90a5c9
<link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
Packit 90a5c9
<link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" />
Packit 90a5c9
<script src="./style/scripts/prettify.min.js" type="text/javascript">
Packit 90a5c9
</script>
Packit 90a5c9
Packit 90a5c9
<link href="./images/favicon.ico" rel="shortcut icon" /></head>
Packit 90a5c9
<body id="manual-page">
Packit 90a5c9

Modules | Directives | FAQ | Glossary | Sitemap

Packit 90a5c9

Apache HTTP Server Version 2.4

Packit 90a5c9
Packit 90a5c9
<-
Packit 90a5c9
Packit 90a5c9
Apache > HTTP Server > Documentation > Version 2.4

Configuration Files

Packit 90a5c9
Packit 90a5c9

Available Languages:  de  |

Packit 90a5c9
 en  |
Packit 90a5c9
 fr  |
Packit 90a5c9
 ja  |
Packit 90a5c9
 ko  |
Packit 90a5c9
 tr 

Packit 90a5c9
Packit 90a5c9
Packit 90a5c9

This document describes the files used to configure Apache HTTP

Packit 90a5c9
Server.

Packit 90a5c9
Packit 90a5c9
Packit 90a5c9
  • Syntax of the Configuration Files
  • Packit 90a5c9
  • Modules
  • Packit 90a5c9
  • Scope of Directives
  • Packit 90a5c9
  • .htaccess Files
  • Packit 90a5c9

    See also

    Packit 90a5c9
    top
    Packit 90a5c9
    Packit 90a5c9

    Main Configuration Files

    Packit 90a5c9
        
    Packit 90a5c9
        
    Packit 90a5c9
    Packit 90a5c9
        

    Apache HTTP Server is configured by placing directives in plain text

    Packit 90a5c9
        configuration files. The main configuration file is usually called
    Packit 90a5c9
        httpd.conf. The location of this file is set at
    Packit 90a5c9
        compile-time, but may be overridden with the -f
    Packit 90a5c9
        command line flag. In addition, other configuration files may be
    Packit 90a5c9
        added using the Include
    Packit 90a5c9
        directive, and wildcards can be used to include many configuration
    Packit 90a5c9
        files. Any directive may be placed in any of these configuration
    Packit 90a5c9
        files. Changes to the main configuration files are only
    Packit 90a5c9
        recognized by httpd when it is started or restarted.

    Packit 90a5c9
    Packit 90a5c9
        

    The server also reads a file containing mime document types;

    Packit 90a5c9
        the filename is set by the TypesConfig directive,
    Packit 90a5c9
        and is mime.types by default.

    Packit 90a5c9
      
    top
    Packit 90a5c9
    Packit 90a5c9

    Syntax of the Configuration Files

    Packit 90a5c9
        
    Packit 90a5c9
    Packit 90a5c9
        

    httpd configuration files contain one directive per line.

    Packit 90a5c9
        The backslash "\" may be used as the last character on a line
    Packit 90a5c9
        to indicate that the directive continues onto the next line.
    Packit 90a5c9
        There must be no other characters or white space between the
    Packit 90a5c9
        backslash and the end of the line.

    Packit 90a5c9
    Packit 90a5c9
        

    Arguments to directives are separated by whitespace. If an

    Packit 90a5c9
        argument contains spaces, you must enclose that argument in quotes.

    Packit 90a5c9
    Packit 90a5c9
        

    Directives in the configuration files are case-insensitive,

    Packit 90a5c9
        but arguments to directives are often case sensitive. Lines
    Packit 90a5c9
        that begin with the hash character "#" are considered
    Packit 90a5c9
        comments, and are ignored. Comments may not be
    Packit 90a5c9
        included on the same line as a configuration directive. 
    Packit 90a5c9
        White space occurring before a directive is ignored, so
    Packit 90a5c9
        you may indent directives for clarity. Blank lines are also ignored.

    Packit 90a5c9
    Packit 90a5c9
        

    The values of variables defined with the Define of or shell environment variables can

    Packit 90a5c9
        be used in configuration file lines using the syntax ${VAR}.
    Packit 90a5c9
        If "VAR" is the name of a valid variable, the value of that variable is
    Packit 90a5c9
        substituted into that spot in the configuration file line, and processing
    Packit 90a5c9
        continues as if that text were found directly in the configuration file.
    Packit 90a5c9
        Variables defined with Define take
    Packit 90a5c9
        precedence over shell environment variables.
    Packit 90a5c9
        If the "VAR" variable is not found, the characters ${VAR}
    Packit 90a5c9
        are left unchanged, and a warning is logged.
    Packit 90a5c9
        Variable names may not contain colon ":" characters, to avoid clashes with
    Packit 90a5c9
        RewriteMap's syntax.

    Packit 90a5c9
    Packit 90a5c9
        

    Only shell environment variables defined before the server is started

    Packit 90a5c9
        can be used in expansions. Environment variables defined in the
    Packit 90a5c9
        configuration file itself, for example with SetEnv, take effect too late to be used for
    Packit 90a5c9
        expansions in the configuration file.

    Packit 90a5c9
    Packit 90a5c9
        

    The maximum length of a line in normal configuration files, after

    Packit 90a5c9
        variable substitution and joining any continued lines, is approximately
    Packit 90a5c9
        16 MiB. In .htaccess files, the
    Packit 90a5c9
        maximum length is 8190 characters.

    Packit 90a5c9
    Packit 90a5c9
        

    You can check your configuration files for syntax errors

    Packit 90a5c9
        without starting the server by using apachectl
    Packit 90a5c9
        configtest or the -t command line
    Packit 90a5c9
        option.

    Packit 90a5c9
    Packit 90a5c9
        

    You can use mod_info's -DDUMP_CONFIG to

    Packit 90a5c9
        dump the configuration with all included files and environment
    Packit 90a5c9
        variables resolved and all comments and non-matching
    Packit 90a5c9
        <IfDefine> and
    Packit 90a5c9
        <IfModule> sections
    Packit 90a5c9
        removed. However, the output does not reflect the merging or overriding
    Packit 90a5c9
        that may happen for repeated directives.

    Packit 90a5c9
      
    top
    Packit 90a5c9
    Packit 90a5c9

    Modules

    Packit 90a5c9
        
    Packit 90a5c9
    Packit 90a5c9
        
    Packit 90a5c9
    Packit 90a5c9
        

    httpd is a modular server. This implies that only the most

    Packit 90a5c9
        basic functionality is included in the core server. Extended
    Packit 90a5c9
        features are available through modules which can be loaded
    Packit 90a5c9
        into httpd. By default, a base set of modules is
    Packit 90a5c9
        included in the server at compile-time. If the server is
    Packit 90a5c9
        compiled to use dynamically loaded
    Packit 90a5c9
        modules, then modules can be compiled separately and added at
    Packit 90a5c9
        any time using the LoadModule
    Packit 90a5c9
        directive.
    Packit 90a5c9
        Otherwise, httpd must be recompiled to add or remove modules.
    Packit 90a5c9
        Configuration directives may be included conditional on a
    Packit 90a5c9
        presence of a particular module by enclosing them in an <IfModule> block. However,
    Packit 90a5c9
        <IfModule> blocks are not
    Packit 90a5c9
        required, and in some cases may mask the fact that you're missing an
    Packit 90a5c9
        important module.

    Packit 90a5c9
    Packit 90a5c9
        

    To see which modules are currently compiled into the server,

    Packit 90a5c9
        you can use the -l command line option. You can also
    Packit 90a5c9
        see what modules are loaded dynamically using the -M
    Packit 90a5c9
        command line option.

    Packit 90a5c9
      
    top
    Packit 90a5c9
    Packit 90a5c9

    Scope of Directives

    Packit 90a5c9
        
    Packit 90a5c9
    Packit 90a5c9
        
    Packit 90a5c9
    Packit 90a5c9
        

    Directives placed in the main configuration files apply to

    Packit 90a5c9
        the entire server. If you wish to change the configuration for
    Packit 90a5c9
        only a part of the server, you can scope your directives by
    Packit 90a5c9
        placing them in <Directory>, <DirectoryMatch>, <Files>, <FilesMatch>, <Location>, and <LocationMatch>
    Packit 90a5c9
        sections. These sections limit the application of the
    Packit 90a5c9
        directives which they enclose to particular filesystem
    Packit 90a5c9
        locations or URLs. They can also be nested, allowing for very
    Packit 90a5c9
        fine grained configuration.

    Packit 90a5c9
    Packit 90a5c9
        

    httpd has the capability to serve many different websites

    Packit 90a5c9
        simultaneously. This is called Virtual
    Packit 90a5c9
        Hosting. Directives can also be scoped by placing them
    Packit 90a5c9
        inside <VirtualHost>
    Packit 90a5c9
        sections, so that they will only apply to requests for a
    Packit 90a5c9
        particular website.

    Packit 90a5c9
    Packit 90a5c9
        

    Although most directives can be placed in any of these

    Packit 90a5c9
        sections, some directives do not make sense in some contexts.
    Packit 90a5c9
        For example, directives controlling process creation can only
    Packit 90a5c9
        be placed in the main server context. To find which directives
    Packit 90a5c9
        can be placed in which sections, check the Context of the
    Packit 90a5c9
        directive. For further information, we provide details on How Directory, Location and Files sections
    Packit 90a5c9
        work.

    Packit 90a5c9
      
    top
    Packit 90a5c9
    Packit 90a5c9

    .htaccess Files

    Packit 90a5c9
        
    Packit 90a5c9
    Packit 90a5c9
        
    Packit 90a5c9
    Packit 90a5c9
        

    httpd allows for decentralized management of configuration

    Packit 90a5c9
        via special files placed inside the web tree. The special files
    Packit 90a5c9
        are usually called .htaccess, but any name can be
    Packit 90a5c9
        specified in the AccessFileName
    Packit 90a5c9
        directive. Directives placed in .htaccess files
    Packit 90a5c9
        apply to the directory where you place the file, and all
    Packit 90a5c9
        sub-directories. The .htaccess files follow the
    Packit 90a5c9
        same syntax as the main configuration files. Since
    Packit 90a5c9
        .htaccess files are read on every request, changes
    Packit 90a5c9
        made in these files take immediate effect.

    Packit 90a5c9
    Packit 90a5c9
        

    To find which directives can be placed in

    Packit 90a5c9
        .htaccess files, check the Context of the
    Packit 90a5c9
        directive. The server administrator further controls what
    Packit 90a5c9
        directives may be placed in .htaccess files by
    Packit 90a5c9
        configuring the AllowOverride
    Packit 90a5c9
        directive in the main configuration files.

    Packit 90a5c9
    Packit 90a5c9
        

    For more information on .htaccess files, see

    Packit 90a5c9
        the .htaccess tutorial.

    Packit 90a5c9
      
    Packit 90a5c9
    Packit 90a5c9

    Available Languages:  de  |

    Packit 90a5c9
     en  |
    Packit 90a5c9
     fr  |
    Packit 90a5c9
     ja  |
    Packit 90a5c9
     ko  |
    Packit 90a5c9
     tr 

    Packit 90a5c9
    top

    Comments

    Notice:
    This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.
    Packit 90a5c9
    <script type="text/javascript">
    Packit 90a5c9
    var comments_shortname = 'httpd';
    Packit 90a5c9
    var comments_identifier = 'http://httpd.apache.org/docs/2.4/configuring.html';
    Packit 90a5c9
    (function(w, d) {
    Packit 90a5c9
        if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
    Packit 90a5c9
            d.write('
    <\/div>');
    Packit 90a5c9
            var s = d.createElement('script');
    Packit 90a5c9
            s.type = 'text/javascript';
    Packit 90a5c9
            s.async = true;
    Packit 90a5c9
            s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
    Packit 90a5c9
            (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
    Packit 90a5c9
        }
    Packit 90a5c9
        else { 
    Packit 90a5c9
            d.write('
    Comments are disabled for this page at the moment.<\/div>');
    Packit 90a5c9
        }
    Packit 90a5c9
    })(window, document);
    Packit 90a5c9
    //--></script>
    Packit 90a5c9

    Copyright 2018 The Apache Software Foundation.
    Licensed under the Apache License, Version 2.0.

    Packit 90a5c9

    Modules | Directives | FAQ | Glossary | Sitemap

    <script type="text/javascript">
    Packit 90a5c9
    if (typeof(prettyPrint) !== 'undefined') {
    Packit 90a5c9
        prettyPrint();
    Packit 90a5c9
    }
    Packit 90a5c9
    //--></script>
    Packit 90a5c9
    </body></html>