本地共享,上传到linux系统中

yum -y install cifs-utils

mount //192.168.10.10/Apache /opt/


cd /optcd

tar zxf httpd-2.4.4.tar.gz -C /media/

tar zxf apr-1.4.6.tar.gz -C /media/

tar zxf apr-util-1.4.1.tar.gz -C /media/


cd /media

cp -r apr-1.4.6 httpd-2.4.2/srclib/apr

cp -r apr-util-1.4.1 httpd-2.4.2/srclib/apr-util


yum -y install \

gcc \

gcc-c++ \

make \

pcre-devel


cp  httpd-2.4.4

./configure \

--prefix=/usr/local/apache \

--enable-so \

--enable-rewrite \

--enable-mods-shared=most \

--with-mpm=worker \

--disable-cgid \

--disable-cgi


参数解释:

--prefix=   //来指定安装路径


--enable-so  //该参数表示支持用mod_so模块提供的功能,用LoadModule在httpd.conf文件或包含的conf文件中动态加载某个模块。让 Apache 可以支持DSO模式


--enable-rewrite  //支持 URL 重写


--enable-mods-shared=most  //选项:告诉编译器将所有标准模块都动态编译为DSO模块。


--with-mpm=worker // 让apache以worker方式运行


--with-mpm=worker   //该参数是配置apache将以何种模式编译的。Apache网站文档指出不同操作系统下的不同的默认模式.


--disable-cgid //禁止用一个外部 CGI 守护进程执行CGI脚本


--disable-cgi //禁止编译 CGI 版本的 PHP


make

make install


----------使程序可以使用service 管理-----------

"service管理的命令都在/etc/init.d/这个目录下的"


grep -v "#" /usr/local/apache/bin/apachectl  > /etc/init.d/httpd

vi /etc/init.d/httpd

在文件最前面插入下面的行,使其支持chkconfig命令:

    #!/bin/sh

             # chkconfig: 2345 85 15

             # description: Apache is a World Wide Web server.

第一行4个数字参数意义分别为:哪些Linux级别需要启动httpd(2,3,4,5);启动序号(85);关闭序号(15)。


chmod  +x  /etc/init.d/httpd


chkconfig --add httpd //注如果在/etc/init.d/apache不编辑这个# chkconfig: 2345 85 15内容的话,

就没法用chkconfig --add来添加apache这个服务的


chkconfig --list httpd


---------以上都是安装部分------------

vi conf/httpd.conf(# vi /usr/local/apache/conf/httpd.conf)

ServerName //设置成hostname显示的名称

Listen 192.168.5.2:80//添加或修改监听本地的IPv4的地址的80端口

ServerName www.benet.com

ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf


service httpd restart

netstat -anpt | grep 80


tail /usr/local/apache/logs/access_log

tail /usr/local/apache/logs/error_log