This paper summarizes the common modules of http2.2.
Note: Close SELinux and the iptables
Permanently closed:
Vim/etc/sysconfig/selinux set to disabled
Yum Install httpd-manual installation httpd manual ip/manual can be accessed
Global configuration:
Primary server segment configuration (or virtual host configuration, both of which take effect one);
Global configuration:
Listen// can listen to multiple ports
KeepAlive// whether to keep the connection
#MPM Working mode configuration: Default is prefork
<ifmodule prefork.c>
Startservers 8// number of processes started during server initialization
Minspareservers 5// minimum number of idle processes
Maxspareservers// maximum number of idle processes
Serverlimit// maximum number of processes allowed maxclients to start online
MaxClients// Maximum number of startup processes allowed to respond to clients. Maximum number of concurrent responses
Maxrequestsperchild 4000
</IfModule>
Woker working mode:
<ifmodule worker.c>
Startservers 4
MaxClients 300
Minsparethreads 25
Maxsparethreads 75
Threadsperchild 25
Maxrequestsperchild 0//0 means no limit
</IfModule>
/usr/sbin/httpd-l to view compiled modules
modifying the working mode must be done by modifying another configuration file :
Vim/etc/sysconfig/httpd
// Remove " Httpd=/usr/sbin/httpd.worker " generally stop the service first, and then modify this file to ensure stable
Primary server Segment configuration:
1 serverroot/etc/httpd// Center host location
2 documentroot/var/www/html//web resource storage location, followed by Directory access control, as follows:
<directory " /var/www/html " >
Options Indexes.// control how resources are accessed under this directory
AllowOverride None. access Control-related directives can be placed in the . htaccess file, and whether to add directives to them. affects performance when all is true
Allow from all// access control,Deny is forbidden to access
</Directory>
Access control mechanism:
<directory " /path " ></Directory>
<file "" ></File>// access control for a file
<filematch " pattern " ></FileMatch>// access control for files that conform to regular expressions, as The regular expression engine is used, so it reduces efficiency and seldom uses
<location " URL Directory " ></Location>// similar to Directory, but the path is not a file resource path, instead, the URL path
<locationmatch "" ></Location>
Authentication module: Put in <directory "" ></Directory> in
Specific examples:
[Email protected]_2 ~]# Vim/etc/sysconfig/selinux
[Email protected]_2 ~]# mkdir/webtest/admin/
[Email protected]_2 ~]# vim/webtest/admin/index.html
[Email protected]_2 ~]# Curl 202.193.52.228/admin
can be accessed normally
Modify the configuration file, define permissions for the directory
<directory "/webtest/admin" >
Options None
AllowOverride None
AuthType Basic
AuthName "Admin auth Test"
AuthUserFile "/ETC/HTTPD/CONF/.HTPASSWD"
Require User CentOS
</Directory>
Htpasswd-c-m|-s./.HTPASSWD username
-C: Create file
-M: Specify MD5 encryption Method
-S: Specify the sha encryption Method
Group-based control:
(1) modifying content in Directory
added:authgroupfile " /etc/httpd/conf/.htgroup "
(2) htpasswd command to create a user password
Htpasswd-c-M/htpasswd root// If the file exists, you do not need to write the- c option, otherwise it will overwrite
(3) writing a . Htgroup file in the format grouname:user1 user2
3 Define the main page of the site:
DirectoryIndex index.html Index.html.var
4 defining path aliases
alias/url/ " the actual resource location "
5 Log Module
Errorlog logs/error_log// error log
Customlog Logs/access_log Combined// access log format
6 Status: outputs the current server startup process and process status
<Location/server-status>
SetHandler Server-status
Order Deny,allow
Allow from all// real-world only open localhost
# Allow from. example.com
</Location>
Enter Http://ip/server-status in the browser
This article is from the "11881794" blog, please be sure to keep this source http://11891794.blog.51cto.com/11881794/1884143
httpd configuration file in the common module of a detailed