简介:httpd是apache软件基金会下的一员,是web服务的主程序之一。注意:要配置web服务,就得配置固定的IP地址。
安装与配置:
1、下载软件包,访问官网http://httpd.apache.org
2.将下载的软件包上传到rhel6的root目录下面并解压
[root@test ~]#cd /root
[root@test ~]# tar xf httpd-2.2.25.tar.bz2
[root@test ~]# cd httpd-2.2.25
3.开始编译安装
. 首先查看编译环境是否安装
yum grouplist |grep "Server Platform Development" && yum group list "Development tools".
可以使用 yum groupinstall "Server Platform Development" "Development tools" 进行安装
. 查看帮助文件
[root@test httpd-2.2.25]# less INSTALL
APACHE INSTALLATION OVERVIEW
Quick Start - Unix
------------------
For complete installation documentation, see [ht]docs/manual/install.html or
http://httpd.apache.org/docs/2.2/install.html
$ ./configure --prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start
[root@test httpd-2.2.25]#./configure --help #查看安装选项
[root@test httpd-2.2.25]#./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so #指定安装目录为/usr/local/apahce,配置文件目录为/etc/httpd/ --enable-so 打开模块化功能。其它功能可根据自己的需要来自定义。
[root@test httpd-2.2.25]#make
[root@test httpd-2.2.25]#make install
[root@test httpd-2.2.25]#cd /usr/local/apache
[root@test apache]# ls
bin build cgi-bin error htdocs icons include lib logs man manual modules
4.配置命令执行环境
.在/etc/profile.d/ 目录中用文本编辑器创建httpd.sh,添加如下内容:
PATH=/usr/local/apache/bin:$PATH
export PATH
[root@test apache]#. /etc/profile.d/httpd.sh #使环境变量生效
[root@test apache]#cd
[root@test ~]# apachectl start #启动服务,会有一段时间解析主机名,得等会儿。
[root@test ~]# netstat -tln #查看80端口是否启动
5.浏览器访问web服务ip地址
6.为了以后做二次开发,需要将头文件、库文件导出,要使用man帮助,也需要将man文件导出
1)导出头文件
[root@test apache]# ln -sv /usr/local/apache/include /usr/include/httpd
2)导出lib库文件
在/etc/ld.so.conf.d/ 目录下创建 httpd.conf文件,用文本编辑器(vi、vim)添加如下内容:
/usr/local/apache/lib
3)让系统重新生成库文件路径缓存
[root@test apache]# ldconfig -v |grep "^[^[:space:]]"
/usr/lib64/atlas:
/usr/local/apache/lib:
/usr/lib64/mysql:
/usr/lib64/qt-3.3/lib:
/lib:
/lib64:
/usr/lib:
/usr/lib64:
/lib64/tls: (hwcap: 0x8000000000000000)
/usr/lib64/sse2: (hwcap: 0x0000000004000000)
/usr/lib64/tls: (hwcap: 0x8000000000000000)
4)导出man文件
用文本编辑器打开 /etc/man.conf文件,在里面添加如下内容:
MANPATH=/usr/local/apache/man
转载于:https://blog.51cto.com/feilongbcd/1764111