YUM方式安装Httpd配置文件解析


#【全局配置】
#定义网站根目录,一下所有目录以此目录为相对路径
ServerRoot "/etc/httpd"

#定义网站名称
ServerName localhost

#配置监听的端口,可设置多个,用空格隔开
Listen 80

#包含独立模块配置文件
Include conf.modules.d/*.conf

#定义运行的用户组
User apache
Group apache


#定义服务器管理员
ServerAdmin root@localhost

#【核心配置】

#定义文档根目录权限
<Directory />
    AllowOverride None
    Require all denied
</Directory>


#定义www目录访问权限
<Directory "/var/www">
    AllowOverride None
    Require all granted
</Directory>


#定义首页
<IfModule dir_module>
    DirectoryIndex index.html index.php 
</IfModule>

#限制.ht*文件不可访问
<Files ".ht*">
    Require all denied
</Files>

#定义错误日志
ErrorLog "logs/error_log"

#定义错误等级
LogLevel warn

#定义日志配置文件
<IfModule log_config_module>
   
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "logs/access_log" combined
</IfModule>

#定义别名
<IfModule alias_module>
       ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>

#定义cgi-bin目录的访问权限
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

#定义mime模块属性
<IfModule mime_module>
     TypesConfig /etc/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

<IfModule mime_magic_module>
       MIMEMagicFile conf/magic
</IfModule>

#定义默认字符
AddDefaultCharset UTF-8

#定义文件发送
EnableSendfile on

#引入配置文件
IncludeOptional conf.d/*.conf

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值