Apache Instruction Set

Source: Internet
Author: User
Tags http authentication http request require resource root directory

As a top priority for the configuration and management of Apache servers, Apache server directives are very important, as we all know. Here is a detailed introduction to the Apache command set, named Apache Command Encyclopedia, I hope to be able to help you work and study! Specific content:

Basic instructions

First, general configuration commands

1, Accessfilename

Default value: Accessfilename. htaccess

This command is the name of the access control file for the directory;

2, Bindaddress

Default value: Bindaddress *

Set the IP address that the server listens on;

3, DefaultType

Default value: DefaultType text/html

When the server does not know the file type, it notifies the client with the default value;

4, DocumentRoot

Default value: DocumentRoot "/var/www/html/"

Set up the directory where Apache provides file services;

5, ErrorDocument

Set the response that Apache does when a problem occurs;


Commands for using modules not included in Apache installation

7, Include

Contains additional configuration files

8, Listen

Default value: All IP addresses that can be connected to the server

Specifies how to respond to address requests that are removed from port-specified ports address;

9. Options

Control the server functions that a particular directory can use;

The values are:

None: represents only browsing,

FollowSymLinks: Allow pages to be connected elsewhere,

EXECCGI: Allow CGI to execute,

MultiViews: Allow to watch animation or listen to music and other actions,

Indexes: Allows the server to return a formatted list of directories,

Includes: SSI is allowed. These settings can be checked.

All: You can do anything but do not include multiviews.

AllowOverride: The None parameter indicates that anyone can browse the files in the directory.

The other parameters are: FileInfo, Authconfig, Limit.

10, Port

Default value: Port 80

Set up the network port on which the server listens;

11, ServerAdmin

Set up an administrator's e-mail address;

12, ServerName

Set the host name of the server;

13, ServerRoot

Default value: serverroot/etc/httpd/

Set the root directory of the server;

14. User && Group

Specifies the user ID and group ID used by the server to answer the request;

Ii. performance and resource configuration commands

1. Process Control

1.1, MaxClients

Default value: MaxClients 150

Set the number of requests that can serve at the same time;

1.2, Maxrequestsperchild

Default value: Maxrequestsperchild 0

Sets the maximum number of requests that each process can respond to, with 0 indicating no limit;

1.3, Maxspareservers

Default value: Maxspareservers 10

Set the maximum number of idle service processes; Minspareservers Set minimum idle service process number;

1.4, ServerType

Default value: ServerType standalone

Set the way the system executes the server;

1.5, StartServer

Default value: StartServer 5

The number of child processes that were established when the server was started;

1.6, Threadsperchild

Default value: Threadsperchild 50

Set the number of threads used by the Apache server;

1.7, Timeout

Default value: Timeout 300

Sets the timeout value for processing a request;

2. Establish continuous connection

2.1, KeepAlive

Default value: KeepAlive on

Set to open or close TCP connections in Apache 2.2, KeepAliveTimeout

Default value: KeepAliveTimeout 5

Set the time to wait for the TCP connection to be turned off in Apache;

2.3, Maxkeepaliverequests

Default value: Maxkeepaliverequests 100

Sets the maximum number of requests per connection for persistent connections;

3. Control system resources


Control the time that the Apache process consumes CPU;

3.2, Rlimitmem

Control the amount of memory consumed by the Apache process;

3.3, Rlimitnproc

Set the maximum number of concurrent processes per user;

4. Dynamic Loading Module

4.1, Addmodule

Mount a precompiled module that is not used by the current server;

4.2, Clearmodulelist

Clears the list of precompiled modules;

Third, the standard container command


and container directives, which are applied to the specified directory and its subdirectories;


And in addition to using regular expressions as parameters and not needing wildcard characters ~, and



And containers are used to set access by file name;


and similar, but cannot use wildcards ~;


and container commands are used to provide access control through a URL.


And the same, just can't use the wildcard character ~.

Four, the Virtual host command


Define a specific virtual host.

2, Namevirtualhost

Use this command if you want to make a virtual host based on a name.

3, Serveralias

A name-based virtual host that contains multiple IP names. You can use a separate virtual host command to define all the IP names.

Five, log command



Default value: ErrorLog logs/error_log

Set the error log file.



Default value: Lockfile logs/accept.lock

The path used to set the lock file to ensure that only the Apache server has read and write access to this file.



Default value: Pidfile logs/httpd.pid

A file that sets the process ID of the Apache Server record daemon.



Default value: Scoreboardfile logs/apache_status

Sets the path to store the internal process data files.

VI. Certification of security orders



Default value: AllowOverride all

When the server finds the file specified by Accessfilename, you need to know that the instructions in that file can overwrite instructions that appear earlier in the configuration file.

AllowOverride can be set to none, the contents of the file are not read at this time, and if set to all, the server will allow all instructions.



Set the label for a resource that requires authentication.



Select the authentication type to use for a directory.



Default value: Hostnamelookups off

Set Apache allows or disables DNS lookups for each request.


And the wrapped instructions are applied only to any valid HTTP access method specified.

6, require

This command selects users who have been authenticated to access the directory.

7, Satisfy

If you have established a basic HTTP authentication configuration and have used both the Allow and require commands, you can use this command to configure the conditions in which Apache can meet the requirements of authentication.

Standard modules



Provides access control based on the host name or IP address of the client.

1.1, allow

A typical application is in a container to allow access to eligible hosts.

1.2, deny

A typical application is in a container, which is used to prohibit eligible host access.

1.3. Order

Used to control the order of allow and deny directives.



can provide CGI scripts or HTTP request methods based on MIME type.

2.1. Action

Specifies an action for a specific mime-type.

2.2. Script

This command is similar to action, but instead of linking operations to Mime-type, it links actions to HTTP request methods, such as get and put.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.