apache配置文件详解

配置文件详解
文件位置:
/etc/httpd/conf/httpd.conf

# vim /etc/httpd/conf/httpd.conf 
ServerRoot "/etc/httpd"      //服务器的根路径,改文件中所有涉及到的路径的根都是相对它而言的。
Listen 80        //监听的端口
Include conf.modules.d/*.conf   //包含辅助配置文件目录下的所有以.conf结尾的;;;文件(/etc/httpd/conf.modules.d/*.conf)

User apache       //运行web服务的用户
Group apache    

ServerAdmin root@localhost    //管理员邮件地址
#ServerName www.example.com:80  //服务器的名字
ServerName www.uplooking.com:80

<Directory />   ---容器,对整个目录中的东西进行设置,权限等等
    AllowOverride none
    Require all denied
</Directory>

DocumentRoot "/var/www/html"    //web服务文档根路径

<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

<Directory "/var/www/html">
    Options Indexes FollowSymLinks     //Indexes:索引目录,(默认没有主页时),允许索引目录   FollowSymLinks:支持符号链接  软连接
    AllowOverride None     //和访问权限有关  可以进行认证        None --不使用认证  all--应用所有的认证指令  AuthConfig  --允许使用与认证授权相关的指令
    Require all granted    //访问控制  所有人方行
</Directory>
    
<IfModule dir_module>
    DirectoryIndex index.html    //网站索引页的名称
</IfModule>

<Files ".ht*">   //以所有.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>   
    # Alias /webpath /full/filesystem/path   //给路径设置别名  意味着访问http://Server_ip/webpath时,其页面文件来自于/full/filesystem/path中
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"   //脚本路径的别名
</IfModule>

<Directory "/var/www/cgi-bin">   
    AllowOverride None
    Options None
    Require all granted
</Directory>

<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>

AddDefaultCharset UTF-8   //默认字符集


#EnableMMAP off    //线程模式
EnableSendfile on   //开启进程模式(默认)

IncludeOptional conf.d/*.conf    //包含辅助配置文件目录下的所有以.conf结尾的文件(/etc/httpd/conf.d/*.conf)


讨论技术可加群:438676220
  • 2
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值