5.apache Tutorials
httpd.conf file Analysis
ServerRoot "E:/phpwebenv/phptutorial/apache" #apache软件安装的位置
Listen #服务器监听的端口号
ServerName localhost #主站点名称 (host name of the website)
DocumentRoot "E:\phpwebenv\PHPTutorial\WWW" #主站点的网页存储位置
<directory/>Options+indexes +followsymlinks +execcgi allowoverride all Order allow,deny allow from allRequireAll granted</directory>5.1Options: Configure which features are used in a particular directory, common values and basic meanings are as follows: execcgi:CGI scripts are allowed to execute in this directory. FollowSymLinks:in this directory, the file system is allowed to use symbolic connections. Indexes: When a user accesses the directory, if the user cannot find the master file specified by DirectoryIndex (for example, index.html),The list of files in the directory is returned to the user. SymLinksIfOwnerMatch:When symbolic connections are used, access is only available if the file owner of the symbolic connection is the same as the owner of the actual file. 5.2 allowoverride: Allows the type of instruction that exists in the. htaccess file (.htaccess file name can be changed, its file name is determined by the Accessfilename Directive): None: When AllowOverride is set to none. Do not search under this directory.htaccess file (can reduce server overhead). AllIn.All instructions can be used in the htaccess file5.3Order: Controls the Allow and deny two access rules on Access which takes precedence: allows access to a list of hosts (available domain names or subnets, for example: Enable from192.168.0.0/16). Deny: The list of hosts that are denied access.
5.4 Server Optimization
Httpd-l all of Apache's modules
5.5 Log Settings
Errorlog "Logs/error.log" #日志文件保存位置
LogLevel the level of the error # Log
The behavior of the logger (Logger) is hierarchical. As shown in the following table:
Divided into off, FATAL, ERROR, WARN, INFO, DEBUG, all, or the level you define.
LOG4J recommends using only four levels, with the priority from high to low being ERROR, WARN, INFO, DEBUG.
# errorlog "Logs/error.log" #ErrorLog "|bin/rotatelogs.exe-l logs/error-%y-%m-%d.log 2M"
If you are file-path using a pipe symbol (|) Begins, a command is assigned to it to handle the error log
5.5.2 Log Rules
Logformat "%h%l%u%t"%r "%>s%b"%{referer}i ""%{user-agent}i "" combined
Logformat "%h%l%u%t"%r "%>s%b" common #common为日志格式名称
%h-%l--the This is the RFC 1413 identity that is determined by the client Identd, the symbol in the output"-"%u-the client name that is obtained by the HTTP authentication system to access the page. Only valid when there is authentication, the symbol in the output "-"%t--"%r"--%>s--%b--"%{referer}i"--
1. Case: rule 1. " %h%l%u%t \ "%r\"%>s%b \ "%{referer}i\" \ "%{user-agent}i\" " combined eg:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) applewebkit/537.36 (khtml, like Gecko) chrome/62.0.3202.75 safari/537.36 " rule 2. " %h%l%u%t \ "%r\"%>s%b " common 127.0.0.1--[06/jan/2018:16:02:27 +0800]" GET/USER/1 http/1.1 "200 206 127.0.0.1--[06/jan/2018:16:02:27 +0800] "Get/favicon.ico http/1.1" 200-
5.6 Virtual Host Configuration
1. Virtual host configuration for the server domain name of a single IP address
<virtualhost *:80>DocumentRoot"E:\phpwebenv\PHPTutorial\WWW\vue"ServerName W. Vue.com serveralias vue.com<directory "E:\phpwebenv\PHPTutorial\WWW\vue" >Options followsymlinks execcgi allowoverride all Order allow,deny allow from allRequireAll granted</Directory></VirtualHost>
2. Multiple IP and multi-port virtual host configuration
Listen 192.168.2.2:80
Listen 192.168.2.3:8080
<virtualhost 192.168.2.2:80>
DocumentRoot ""
ServerName www.baidu.com
accssfilename. htaccess
</VirtualHost>
#. htaccess files (or "distributed Profiles") provide a way to change the configuration for each directory by placing a file containing instructions in a particular directory.
Where the instruction acts on this directory and all its subdirectories
5.7 Configuration of SSL encryption
5.8.
Apache Learning Tutorials