http(apache)服务配置文件详解

[root@server ~]# tree /etc/httpd
/etc/httpd					##配置文件路径
├── conf					##主配置文件目录
│   ├── httpd.conf			##主配置文件
│   └── magic
├── conf.d					##扩展配置文件目录
│   ├── autoindex.conf
│   ├── README
│   ├── userdir.conf
│   └── welcome.conf
├── conf.modules.d			##功能模块配置文件目录
│   ├── 00-base.conf
│   ├── 00-dav.conf
│   ├── 00-lua.conf
│   ├── 00-mpm.conf
│   ├── 00-optional.conf
│   ├── 00-proxy.conf
│   ├── 00-systemd.conf
│   ├── 01-cgi.conf
│   ├── 10-h2.conf
│   ├── 10-proxy_h2.conf
│   └── README
├── logs -> ../../var/log/httpd					##日志文件目录
├── modules -> ../../usr/lib64/httpd/modules	##功能模块的目录
├── run -> /run/httpd							##运行进程目录
└── state -> ../../var/lib/httpd				##状态信息目录
##httpd.conf##
31 行 ServerRoot "/etc/httpd"  	##服务根目录路径
44 行 Listen 80 					##指定服务器的监听地址和端口
58 行 Include conf.modules.d/*.conf ##功能模块对应的配置文件
68 行 User apache				##执行httpd服务的用户
69 行 Group apache				##执行httpd用户的所属组
88 行 ServerAdmin root@localhost	##服务器给客户端返回错误信息时包含的地址
97 行 ServerName www.example.com:80 ##指定服务器对应的域名是什么
104 行 				##根目录不允许被修改,对于/目录的访问权限都拒绝
105 行    AllowOverride none
106 行    Require all denied
107 行 
121 行 DocumentRoot "/var/www/html"	##主页存放的路径(网页文件存放的路径)
126 行 		##对于/var/www这个目录
127 行   AllowOverride None			##不允许使用覆盖指令
128 行    # Allow open access:
129 行  	Require all granted			##所有用户都可以访问这个目录下的内容
130 行 
133 行 	##对于/var/www/html目录的控制访问权限
--
146 行    Options Indexes FollowSymLinks
--
153 行    AllowOverride None
--
158 行    Require all granted
159 行 
165 行 			##当用户请求访问一个目录时,这个目录需要包含一个index.html的文件,不返回目录列表,默认访问index.html文件
166 行   DirectoryIndex index.html
167 行 
173 行 				##对所有.ht*开头的文件的访问请求都会被拒绝(防止文静授权的用户来访问文件)
174 行    Require all denied
175 行 
184 行 ErrorLog "logs/error_log"		##错误文件存放路径
191	行 LogLevel warn					##日志级别warn,只有警告及其以上的级别日志才会北记录
##日志级别(从高到低)
emerg,alert,crit,error,warn,notice,info,debug

193 行 		##日志文件的一些格式和存放位置
--
198 行   LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"    %{User-Agent}i\"" combined
199 行    LogFormat "%h %l %u %t \"%r\" %>s %b" common
201 行    
202 行     # You need to enable mod_logio.c to use %I and %O
203 行      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"     \"%{User-Agent}i\" %I %O" combinedio
204 行   
219 行    CustomLog "logs/access_log" combined
220 行 

222 行  			
--
249 行    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"  ##设置脚本的别名,讲CGI通用网关接口脚本接口路径,映射到一个特定目录(运行网站用户执行CGI脚本时,服务器可以在指定目录下寻找并执行脚本)
251 行 

257 行 		##对此目录设置权限
258 行   AllowOverride None
259 行    Options None
260 行    Require all granted
261 行 

263 行 				##对于mine_module的设置,不同文件类型的处理方式
268 行   TypesConfig /etc/mime.types
285 行    AddType application/x-compress .Z
286 行    AddType application/x-gzip .gz .tgz
307 行    AddType text/html .shtml
308 行    AddOutputFilter INCLUDES .shtml
309 行 

318 行 AddDefaultCharset UTF-8				##设置服务器的默认字符集是utf-8

320 行 			##设置mine的MagicFile位置
326 行    MIMEMagicFile conf/magic
327 行 
350 行 EnableSendfile on						##启用操作系统内核的sendfile的支持,提高静态文件的传输效率
355 行 IncludeOptional conf.d/*.conf			##apache服务器包含conf.d/下的所有.conf结尾的配置文件

你可能感兴趣的:(http,apache,网络协议,linux)