httpd:
安装方式:
rpm包安装,光盘
]# rpm -q httpd
httpd-2.2.15-60.el6.centos.4.x86_64
编译
centos6:
配置文件/etc/httpd/conf/httpd.conf
/etc/httpd/ 根目录
conf.d/*.conf作为httpd.conf的补充文件
服务脚本/etc/rc.d/init.d/httpd
配置文件/etc/sysconfig/httpd
主程序文件/
# rpm -ql httpd | grep "bin"
/usr/sbin/apachectl
/usr/sbin/htcacheclean
/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
# The configuration directives are grouped into three basic sections:
# The directives in this section affect the overall operation of Apache,
# The directives in this section set up the values used by the 'main'
# WebDAV module configuration section.
# The first VirtualHost section is used for requests without a known
配置格式:directivevalue
directive: 不区分字符大小写;
value: 为路径时,取决于文件系统;
常用修改配置
~# cp/etc/httpd/conf/httpd.conf{,.bak}
1、修改端口Listen 12.34.56.78:80省略ip表示监听所有端口,listen可以多次
~# ss -tnl |grep '80'
2、持久连接,获取资源后不断开等待请求
persisten connection
如何断开:数量、时间,httpd2.4支持毫秒级持久时间
非持久连接,打开一个资源获取后立即断开
KeepAliveOff|ON选择打开或者关闭持久连接
MaxKeepAliveRequests最大连接数
KeepAliveTimeout15保持时间
请求连接:$ telnet 192.168.5.11 83
GET /URL HTTP1/.1
HOST:HOSTNAME OR IP
3、MPM,multipathprocess module多路处理模块
prefork、worker、event
httpd-2.2不支持同时编译多个模块,所以只能编译时选定一个;rpm安装的包提供三个二进制程序文件,分别用于实现对不同MPM机制的支持,# ps-ax | grep httpd默认为/usr/sbin/httpd,prefork
#httpd -h帮助
#httpd -l查看静态编译模块 -M查看所有模块
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
更换http程序/etc/sysconfig/httpd
#HTTPD=/usr/sbin/httpd.worker|prefork|event
重启服务
httpd.worker -l
Compiled in modules:
core.c
worker.c
http_core.c
mod_so.c
prefork的配置: