ApacheHTTPServer (2) -- Configuration File

Source: Internet
Author: User
Tags mime file
ApacheHTTPServer (2)-Apache, the main configuration file of the configuration file, configures the HTTP server by placing commands in the text configuration file. The main configuration file is usually httpd. conf (apache2 is/etc/apache2/apache2.conf, which will contain httpd. conf), this file... apache HTTP Server (II)-Main configuration file
Apache configures the HTTP server by placing commands in the text configuration file. The main configuration file is usually httpd. conf (apache2 is/etc/apache2/apache2.conf, which will contain httpd. conf), the file is set in the compilation phase, or you can use the command line parameter-f to override it. In addition, its configuration file can be referenced through the Include command. here, you can use wildcards to reference multiple configuration files (such as Hall Include mod-enabled/*. conf ). Httpd loads the main configuration file when it is started or restarted. The server also reads a file containing the mime file type, which is specified by the TypeConfig command. The default value is mime. types. In the syntax configuration file www.2cto.com, use one command as a line. "\" Can be used at the end of a row to indicate that the command occupies multiple rows. The command itself is case-insensitive, but its parameters are usually case-sensitive. Rows starting with # are considered as comments. Blank lines and leading spaces are ignored. The variables defined by Define and shell environment variables can be used in the configuration file in the form of $ {VAR. Variables defined by Define have higher priority than environment variables. If VAR is not defined, $ {VAR} remains unchanged and a warning is triggered. The variable name cannot contain ":" to avoid interfering with the RewriteMap command. Only environment variables defined before the server is started will be expanded. Environment variables defined in the configuration file, such as those defined by SetEnv, are not expanded. The maximum length of the configuration file after variables are expanded and combined with subsequent rows (\ ended) is about 16 MB .. The maximum length of lines in the htaccess file is 8190 characters. Run the command apachectl configtest or apachectl-t to check the configuration file syntax errors without starting the server. The-DUMP-CONFIG of the mod_info module can output parsing all referenced files and environment variables, as well as removing comments, mismatched And Configuration file. The core server of the www.2cto.com module only contains the most basic functions. the extension feature can be used by loading modules. By default, the basic set of a module is included in the server during the compilation period. If the server is compiled to use dynamic loading modules, the modules can be compiled separately and added using the LoadModule command at any time. Otherwise, the server must re-compile to add or delete the module. The commands in the module are executed only when the required module is loaded. for example:
  Listen 443. The command line parameter-l can be used to view the modules compiled into the server, and-M can be used to view dynamically loaded modules. Commands in the main configuration file apply to the entire server. Put in , , , , , And The commands in the block only act on part of the server. They apply commands based on the location or URL of the file system. They can also be nested. Apache allows multiple different websites to run simultaneously, which is called Virtual Hosting. In The commands in the block are only applied to a specific website. Www.2cto.com although most commands can be placed in any block, some commands have no meaning in some contexts. . Htaccess file
If A. htaccess file is placed under a directory, the configuration in it will be applied to the current directory and all its subdirectories .. The syntax of the htaccess file is the same as that of the main configuration file. The file name can also be specified through the AccessFileName command in the main configuration file. Because the. htaccess file is read at each request, any modifications to the file will be immediately reflected. In the main configuration file, you can use AllowOverride to specify which commands can be placed in the. htaccess file. By yourtommy
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.