共计 2216 个字符,预计需要花费 6 分钟才能阅读完成。
httpd 的 rpm 包及源码安装配置
1、rpm 包安装
系统环境:
[root@zhaochj ~]# cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
[root@zhaochj ~]# uname -r
2.6.32-358.el6.x86_64
[root@zhaochj ~]# ifconfig | grep Bcast:
inet addr:192.168.0.200 Bcast:192.168.0.255 Mask:255.255.255.0
查看当前 yum 源中可用的 httpd 安装包:
[root@zhaochj ~]# yum list all *httpd*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
Available Packages
httpd.x86_64 2.2.15-31.el6.centos updates
httpd-devel.i686 2.2.15-31.el6.centos updates
httpd-devel.x86_64 2.2.15-31.el6.centos updates
httpd-manual.noarch 2.2.15-31.el6.centos updates
httpd-tools.x86_64 2.2.15-31.el6.centos updates
安装 httpd:
[root@zhaochj ~]# yum -y install all httpd
查看生成的配置文件:
[root@zhaochj ~]# rpm -qc httpd
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/magic
/etc/logrotate.d/httpd
……
httpd 配置相关的目录结构:
[root@zhaochj httpd]# pwd
/etc/httpd
[root@zhaochj httpd]# tree
.
├── conf
│ ├── httpd.conf
│ ├── httpd.conf.back #对原配置文件做备份
│ └── magic
├── conf.d
│ ├── README
│ └── welcome.conf
├── logs -> ../../var/log/httpd
├── modules -> ../../usr/lib64/httpd/modules
└── run -> ../../var/run/httpd
配置 hosts 文件:
[root@zhaochj httpd]# vim /etc/hosts
192.168.0.200 zhaochj #增加此行
配置主配置文件,启用 ServerName:
[root@zhaochj httpd]# vim conf/httpd.conf
ServerName 192.168.1.200:80 #启用 ServerName, 并修改为
测试配置文件:
[root@zhaochj httpd]# httpd -t
Syntax OK
启用 httpd 服务:
[root@zhaochj httpd]# service httpd start
Starting httpd: [OK]
查看 httpd 的版本 :
[root@zhaochj ~]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Oct 16 2014 14:48:21
查看 httpd 的使用的 MPM,默认是 prefork:
[root@zhaochj httpd]# httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
修改 MPM 为 worker,并验证 :
[root@zhaochj httpd]# vim /etc/sysconfig/httpd
HTTPD=/usr/sbin/httpd.worker #启用此行
[root@zhaochj httpd]# service httpd restart
[root@zhaochj httpd]# ps aux | grep httpd
CentOS 6.5 编译安装 httpd-2.4.7 http://www.linuxidc.com/Linux/2014-02/97265.htm
httpd 中工作模型的比较 http://www.linuxidc.com/Linux/2014-03/99093.htm
源码编译安装 httpd2.4 及虚拟主机 http://www.linuxidc.com/Linux/2014-08/105384.htm
编译安装最新版 httpd-2.4 http://www.linuxidc.com/Linux/2014-03/98761.htm
httpd2.4 基本功能的实现 … http://www.linuxidc.com/Linux/2014-03/98762.htm