每次碰到都不知道具体的作用,所以来分析一下

配置文件结构

apache2在启动的时候自动读取/etc/apache2/apache2.conf文件的配置信息,不同的配置项按功能分布在不同的文件中,然后被Include包含到apache2.conf这个主配置文件中,方便管理。就是说事实上apache2主配置文件只有一个,即apache2.conf,其他的都是被include进来的。

主文件配置内容

### Section 1: Global Environment
#ServerRoot:apache服务器根目录。主配置文件,日志都在该目录。
#注意路径结束时不要加斜杠,默认是/etc/apache2
#ServerRoot "/etc/apache2" LockFile ${APACHE_LOCK_DIR}/accept.lock #apache服务启动时在该文件记录进程ID号
# This needs to be set in /etc/apache2/envvars
PidFile ${APACHE_PID_FILE} #连接超时,单位秒
Timeout 300 #是否允许持久连接
KeepAlive On #持久连接时最大请求数
MaxKeepAliveRequests 100 KeepAliveTimeout 5 # prefork MPM
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule> # worker MPM
<IfModule mpm_worker_module>
StartServers 10
ServerLimit 100
MinSpareThreads 50
MaxSpareThreads 200
ThreadsPerChild 64
MaxClients 6400
MaxRequestsPerChild 0
</IfModule> # event MPM
<IfModule mpm_event_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule> # These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP} #apache服务启动后在每个目录中查找后缀是.htaccess的文件,这些文件作为附加的配置
AccessFileName .htaccess
#下面几行防止.htaccess和.htpassword文件被web客户端访问
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy all
</Files> #DefaultType是浏览器访问的MIME类型,设置为None,让浏览器自行解析
DefaultType None # HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
HostnameLookups Off #错误日志文件目录,默认是配置在此,可在<VirtualHost>中重载
#日志文件取名时以'/'开头会造成冲突,不以'/'开头,会默认加上服务器根目录前缀
#比如"foo.log"会被加上ServerRoor目录"/etc/apache2"变成"/etc/apache2/foo.log"
ErrorLog ${APACHE_LOG_DIR}/error.log #Log日志记录哪些信息,取值可以是: debug, info, notice, warn, error, crit,alert, emerg.
LogLevel warn #导入模块配置文件
Include mods-enabled/*.load
Include mods-enabled/*.conf
#导入所有用户配置文件
Include httpd.conf
#导入端口监听配置文件
Include ports.conf # The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent #拦截访问
<VirtualHost *:80>
<Directory /***>
Options None FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost> #导入通用配置目录
Include conf.d/ #导入虚拟主机的配置
Include sites-enabled/

网站根目录配置文件

在sites-avaliabrary中

Apache2配置文件解读的更多相关文章

  1. 【比赛打分展示双屏管理系统-专业版】Other.ini 配置文件解读以及排行榜界面及专家评语提交展示等具体配置

    第一个问题:Other.ini配置文件的解读: 在软件根目录下,找到Other.ini配置文件,打开如下: 配置文件解读: iOrderIDOrXSID:默认为0,按照软件 选项/排行榜和奖项 的设置 ...

  2. Nginx 小入门记录 之 Nginx 配置文件解读(二)

    上一小节主要是记录一些环境准备和Nginx的安装,接下来对Nginx基本配置进行记录. 查看配置文件安装记录 可以通过以下Linux命令进行查看: rpm -ql nginx rpm 是liunx的包 ...

  3. 从零开始Pytorch-YOLOv3【笔记】(一)配置文件解读

    前言 这是github上的一个项目YOLO_v3_tutorial_from_scratch,它还有相应的blog对其详细的解读.机器之心翻译了他的tutorial:从零开始PyTorch项目:YOL ...

  4. net core体系-web应用程序-4net core2.0大白话带你入门-3asp.net core项目架构和配置文件解读

    asp.net core web项目目录解读   Connected Services 和传统.net web项目相比,它的功能类似于添加webservice或者wcf service的引用.暂时用不 ...

  5. redis 的使用 及 配置文件解读

    redis-server命令 redis-server /usr/local/redis/conf/redis.conf #加配置文件绝对路径启动redis服务 redis-server /usr/l ...

  6. 怎样在idea添加log日志 以及log4j2配置文件解读

    网上找了很多篇文章,就数这篇比较全,从下载到配置都有讲到,解决从0开始接触java日志文件添加的各位同学.参考文章:https://www.cnblogs.com/hong-fithing/p/769 ...

  7. java微信开发(wechat4j)——wechat4j配置文件解读

    wechat4j的配置文件是wechat4j.properties.需要放置在项目src目录下.在wechat4j.jar中的META-INF下有一个wechat4j.properties.sampl ...

  8. Redis配置文件解读

    转载自:http://www.cnblogs.com/daizhj/articles/1956681.html 对部分配置选项做了一些说明 把配置项目从上到下看了一遍,有了个大致的了解,暂时还用不到一 ...

  9. redis 配置文件解读

    # Redis 配置文件 # 当配置中需要配置内存大小时,可以使用 1k, 5GB, 4M 等类似的格式,其转换方式如下(不区分大小写) # # 1k => 1000 bytes # 1kb = ...

随机推荐

  1. 记一次线上环境 ES 主分片为分配故障

    故障前提 ElasticSearch 版本:5.2 集群节点数:5 索引主分片数:5 索引分片副本数:1 线上环境ES存储的数据量很大,当天由于存储故障,导致一时间 5个节点的 ES 集群,同时有两个 ...

  2. CSP2020-儒略历

    大家可以在洛谷提交: 题目描述 为了简便计算,天文学家们使用儒略日(Julian day)来表达时间.所谓儒略日,其定义为从公元前 4713 年 1 月 1 日正午 12 点到此后某一时刻间所经过的天 ...

  3. sed tr 批量转换邮箱格式 去除"\n" 行尾添加";"

    1:从phpmyadmin上拿下来的数据是这样的: 2:od -c 发现存在\r\n (windows上编码问题) $ od -c sql.csv 先将\r处理掉 $ sed 's/\r//' sql ...

  4. SpringBoot 整合thymeleaf

    1.Thymeleaf介绍(官网推荐:https://www.thymeleaf.org/doc/articles/thymeleaf3migration.html) Thymeleaf是跟Veloc ...

  5. properties 文件解析

    1.提供properties文件 jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/future?useUn ...

  6. Maven settings配置阿里镜像

    一般只用配置三个地方 maven仓库路径 镜像 默认JDK版本 <?xml version="1.0" encoding="UTF-8"?> < ...

  7. 津门杯WriteUP

    最近很浮躁,好好学习 WEB power_cut 扫目录 index.php <?php class logger{ public $logFile; public $initMsg; publ ...

  8. ArrayList 源码分析和自定义ArrayList实现

    概述 ArrayList 是基于数组实现的,是一个能自动扩展的动态数组. ArrayList 是线程不安全的,多线程情况下添加元素会出现数组越界的情况,而且数组赋值操作不是原子操作,会导致多线程情况下 ...

  9. celery ValueError: invalid literal for int() with base 10: '26379;sentinel'

    celery使用redis sentinel作为broker的时候,因为redis sentinel配置字符串格式解析报错 ValueError: invalid literal for int() ...

  10. hive 权限排查

    show grant role role_username id username