apache目录及文件讲解
apache目录下bin,conf,htdocs,logs,modules讲解
bin:
ab 压力测试工具
apachectl 启动命令
apxs 安装扩展模块的工具
htcapacheclean 清理磁盘缓冲区命令
htpasswd 建立和更新基本认证文件
httpd 控制命令程序,apachectl执行时会调用
rotatelogs 日志轮询工具,会用cronolog替代
conf 配置文件目录
httpd.conf 主配置文件
extra 子配置文件目录
htdocs 默认站点目录
index.html,index.php,index.jsp 首页文件
首页名字在httpd.conf中事先定义好了
DirectoryIndex index.html
修改好后要重启httpd服务
apachectl -t 或 apachectl graceful(平滑重启)
logs 日志
access_log 访问日志
error_log 错误日志
httpd.pid http进程启动后,会把所有进程的id号写进来
modules 模块目录
httpd.conf 主配置文件介绍
grep -Ev "#|^$" httpd.conf >httpd.conf.ori 排除注释文件
ServerRoot "/application/apache2.2.31" //服务的根目录
Listen 80 //监听端口,是所有ip
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon //默认用户
Group daemon //默认组
</IfModule>
</IfModule>
ServerAdmin you@example.com //管理员邮箱
DocumentRoot "/application/apache2.2.31/htdocs" //默认站点目录
<Directory /> //根目录权限控制
Options FollowSymLinks //允许在此目录中使用符号链接
AllowOverride None //服务器将忽略.htacess文件,禁止重载
Order deny,allow
Deny from all //加上面一行表示不允许任何人访问目录
</Directory>
<Directory "/application/apache2.2.31/htdocs"> //默认目录权限控制
Options Indexes FollowSymLinks //Indexes-->展示目录结构(优化1)
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html //指定访问首页
</IfModule>
<FilesMatch "^\.ht"> //对.ht开头的文件设置权限
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
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" common
</IfModule>
<IfModule alias_module> //cgi配置,以下10行都是,已淘汰,可删掉
ScriptAlias /cgi-bin/ "/application/apache2.2.31/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/application/apache2.2.31/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
DefaultType text/plain //缺省类型
<IfModule mime_module> //指定MIME类型映射文件
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule ssl_module> //ssl配置
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
子配置文件介绍
httpd-autoindex.conf
httpd-info.conf
httpd-mpm.conf //重点
httpd-userdir.conf
httpd-dav.conf
httpd-languages.conf
httpd-multilang-errordoc.conf
httpd-vhosts.conf //重点
httpd-default.conf //了解
httpd-manual.conf
httpd-ssl.conf
httpd-vhost.conf //大部分网站都在这里面配置
NameVirtualHost *:80
<VirtualHost *:80> //基于域名的虚拟主机
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/application/apache2.2.31/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/application/apache2.2.31/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
httpd-mpm.conf
<IfModule !mpm_netware_module> //pid文件
PidFile "logs/httpd.pid"
</IfModule>
<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
LockFile "logs/accept.lock" //锁文件
</IfModule>
</IfModule>
<IfModule mpm_prefork_module> //prefor模式,另一模式是worker
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150 //默认并发数150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module> //worker模式
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_beos_module>
StartThreads 10
MaxClients 50
MaxRequestsPerThread 10000
</IfModule>
<IfModule mpm_netware_module>
ThreadStackSize 65536
StartThreads 250
MinSpareThreads 25
MaxSpareThreads 250
MaxThreads 1000
MaxRequestsPerChild 0
MaxMemFree 100
</IfModule>
<IfModule mpm_mpmt_os2_module>
StartServers 2
MinSpareThreads 5
MaxSpareThreads 10
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_winnt_module>
ThreadsPerChild 150
MaxRequestsPerChild 0
</IfModule>
httpd-default.conf
Timeout 300 //超时时间s
KeepAlive On //保持连接状态
MaxKeepAliveRequests 100 //最大连接数
KeepAliveTimeout 5 //在同一连接上等待下一个请求的时间
UseCanonicalName Off
AccessFileName .htaccess //伪静态的语法写在.htaccess
开发要用,需要给他权限 AllowOverride ALL
ServerTokens Full
ServerSignature On //隐藏apache版本 防黑客
HostnameLookups Off
apache目录及文件讲解的更多相关文章
- linux运维中经常使用的目录和文件讲解
第9章 linux中目录结构 9.1 linux中的常见目录和解释说明 ID 目录 说明 1 bin 命令文件保存的地方 2 sbin 只有root用户才可以使用的命令 3 Boot(了解即可) Li ...
- 二、IntelliJ IDEA 安装目录的核心文件讲解
首先,咱们回顾一下前两篇关于 IntelliJ IDEA 的博文的内容: 在“在 Windows 系统下安装 IntelliJ IDEA 的方法”中,咱们知道了在 Windows 系统下如何下载并安装 ...
- IntelliJ IDEA 安装目录的核心文件讲解
转自:https://blog.csdn.net/qq_35246620/article/details/61916751 首先,我们回顾一下前两篇关于 IntelliJ IDEA 的博文的内容: 在 ...
- Linux文件和目录权限详细讲解
转载请标明出处: http://www.cnblogs.com/why168888/p/5965180.html 本文出自:[Edwin博客园] Linux文件和目录权限解读 如何设置Linxu文件和 ...
- Linux文件和目录权限实战讲解
一 相关课程回顾1.1 linux文件类型当执行ls -l或ls -la 命令后显示的结果中最前面的第2~10个字符是用来表示文件权限 第一个字符一般用来区分文件和目录: d:表示是一个目录,事实上在 ...
- Maven学习详解(13)——Maven常用命令大全与pom文件讲解
一.Maven常用命令 1.1.Maven 参数 -D 传入属性参数 -P 使用pom中指定的配置 -e 显示maven运行出错的信息 -o 离线执行命令,即不去远程仓库更新包 -X 显示ma ...
- [WinAPI] API 13 [遍历指定目录 打印文件和其他属性]
Windows API中,有一组专门的函数和结构,用于遍历目录,它们是FindFirstFile函数.FindNextFile函数和WIN32_FIND_DATA结构.使用FindFirstFile和 ...
- Apache目录结构(一)
一.Apache 目录结构 bin: 该目录用于存放apache常用的命令,比如httpd cig-bin:该目录存放linux下的常用命令 .sh conf:存放配置文件httpd.conf,在ht ...
- 如何让你的Apache支持include文件解析和支持shtml的相关配置
源地址:http://www.itokit.com/2011/0430/65992.html Apache支持include文件解析shtml首先要应该修改Apache配置文件httpd.conf . ...
随机推荐
- 【UVA 11354】 Bond (最小瓶颈生成树、树上倍增)
[题意] n个点m条边的图 q次询问 找到一条从s到t的一条边 使所有边的最大危险系数最小 InputThere will be at most 5 cases in the input file.T ...
- POJ 2075 Tangled in Cables 最小生成树
简单的最小生成树,不过中间却弄了很久,究其原因,主要是第一次做生成树,很多细节不够熟练,find()函数的循环for判断条件是 pre[i]>=0,也就是遇到pre[i]==-1时停止,i就是并 ...
- B*tree dump
Oracle的索引是以平衡树的方式组织存储的:保存的是索引列的值,以及该行的rowid的一部分(文件号,块号,行号) 下面我们通过例子来了解一下: 1,create table test(id int ...
- Specify a culture in string conversion explicitly
Specify a culture in string conversion explicitly There are different methods of grouping symbols, l ...
- 《Spark大数据处理:技术、应用与性能优化 》
基本信息 作者: 高彦杰 丛书名:大数据技术丛书 出版社:机械工业出版社 ISBN:9787111483861 上架时间:2014-11-5 出版日期:2014 年11月 开本:16开 页码:255 ...
- java线程(1)-线程同步
Java提供了两种创建线程方法: 通过实现Runable接口: 通过继承Thread类本身. 线程同步 为何使用同步? java允许多线程并发控制,当多个线程同时操作一个可共享的资源变量时(如数据的 ...
- 【转】你应该知道的十个VirtualBox技巧与高级特性
原文网址:http://www.searchvirtual.com.cn/showcontent_76463.htm VirtualBox集成的许多功能你可能从来没有使用过,即使你经常用它来运行虚拟机 ...
- leecode 树是否是平衡树 java
https://oj.leetcode.com/problems/validate-binary-search-tree/ 1.中序遍历是否有序 /** * Definition for binary ...
- HW4.17
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- How to effectively work with multiple files in Vim?
Why not use tabs (introduced in Vim 7)? You can switch between tabs with :tabn and :tabp, With :tabe ...