CentOS 6:
程序环境
配置文件:
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/*.conf
服务脚本:
/etc/rc.d/init.d/httpd
配置文件:/etc/sysconfig/httpd
主程序文件:
/usr/sbin/httpd
/usr/sbin/httpd.event
/usr/sbin/httpd.worker
日志文件目录:
/var/log/httpd
access_log:访问日志
error_log:错误日志
站点文档目录:
/var/www/html
配置文件的组成:
~]# grep "Section" /etc/httpd/conf/httpd.conf
### Section 1:Golbal Environment
### Section 2:'Main' server configuration
### Section 3:Virtual Hosts
常用配置:
1、修改监听的IP和Port
Listen [IP:]PORT
省略ip表示监听本机所有IP;Listen可重复出现多次;
2、持久连接
Persistent Connection:连接建立,每个资源获取完成后不会断开连接,而是继续等待其它的请求完成;
如何断开?
数量限制:100
时间限制:可配置
副作用:对并发访问量较大的服务器,持久连接功能会使用有些请求得不到响应;
折衷:使用较短的持久连接时间;
httpd-2.4 支持毫秒级持久时间;
非持久连接
KeepAlive On|Off
MaxKeepAliveRequests #
KeepAliveTimeout #
测试:
telnet HOST PORT
GET /URL HTTP/1.1
Host:HOSTNAME or IP
3、MPM
Multipath Process Module:多道处理模块
prefork,worker,event
httpd-2.2不支持同时编译多个模块,所以只能编译时选定一个;rpm安装的包提供三个二进制程序文件,分别用于实现对不同MPM支持:确认方法:
# ps aux | grep httpd
默认为/usr/sbin/httpd,其使用prefork
查看模块列表:
查看静态编译的模块
# httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
查看静态编译及动态装载的模块
# httpd -M
更换使用的httpd程序:
/etc/sysconfig/httpd
HTTPD=
重启服务生效:
prefork的配置:
worker的配置:
PV,UV
PV:Page View
UV:User View
独立IP量:
300*86500