httpd的rpm包及源码安装配置

 

 

首页服务器应用

背景:

阅读新闻

httpd的rpm包及源码安装配置

[日期:2015-01-14]   来源:Linux社区  作者:Linux   [字体:]  

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

httpd中工作模型的比较 

源码编译安装httpd2.4及虚拟主机

编译安装最新版httpd-2.4

httpd2.4基本功能的实现...

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/5ece8c07eba471399b3d0308979abf79.html