189 8069 5689

apache-httpd-server-创新互联

  很久没有写过博客了,今天心血来潮记录下源码安装httpd的过程,如果有错误希望大家提出来,也好改进,谢谢广大博友apache-httpd-serverapache-httpd-serverapache-httpd-server

创新互联建站专注于呼玛企业网站建设,成都响应式网站建设公司,商城系统网站开发。呼玛网站建设公司,为呼玛等地区提供建站服务。全流程按需定制制作,专业设计,全程项目跟踪,创新互联建站专业和态度为您提供的服务

      安装环境:    Asianux3    内核版本:Asianux   3.1

      软件包:    httpd-2.4.12

                         pcre-8.20

                         apr-1.5.2

                         apr-util-1.5.4

      安装步骤:

             1.环境检查:系统是否安装有apr apr-util pcre软件包

                  #rpm -qa apr

                  apr-1.2.7-11

                  #rpm -qa apr-util

                  apr-util-1.2.7-7AXS3

                  #rpm -qa pcre

                  pcre-6.6-2.7

     这些软件系统有自带,但是也不能卸载与其他软件还有依赖关系,所以需要安装其他软件,并且安装到不同的路径下

             2.开始安装前压迫先安装好开发工具库,查看系统是否已安装

                  #yum grouplist

                  基本系统

                  开发

                  gnome库

               我的系统已经安装,如果没有安装则执行

                  #yum groupinstall "开发工具 开发库"   命令进行安装

             3.检查完环境既可以开始安装,要先安装pcre 软件,将软件包拷贝到服务器

                  #tar -jxf pcre-8.20.tar.bz2              //解压pcre软件包

                  #ls                                                  //查看当前目录下会多出一个pcre-8.20目录

                  #cd pcre-8.20                                //切换进pcre目录

                  #./configure --perfix=/usr/local/pcre

                                                                         //编译病指定pcre安装目录

                  #make

                  #make check                                 //验证make结果,不是必须步骤

                  #make install

                  #ls  /usr/local/pcre                        //查看/usr/local/pcre

                  bin    include lib   share

              pcre安装完成。

              4.安装apr软件

                   #tar zxf apr-1.5.2.tar.gz                //解压apr软件包

                   #cd apr-1.5.2

                   #./configure --prefix=/usr/local/apr

                                                                          //编译apr.指定安装路径

                   #make

                   #make install

                   #ls /usr/local/apr

                   bin    include lib   build-1

                apr软件包安装完成

               5.安装apr-util软件

                   #tar zxf apr-util-1.5.4.tar.gz        //解压util软件包

                    #cd apr-util-1.5.4

                   #./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

                                   //编译util软件包,指定安装目录并制定apr软件安装目录。因为util依赖apr软件

                   #make

                   #make install

                   #ls /usr/local/apr-util

                   bin    include lib

                apr-util软件安装完成

                6.就要安装httpd软件了,安装前还要检查selinux是否被禁用(disabled)

                   #vim /etc/selinux/config

                    SELINUX=disabled

                   #tar jxf httpd-2.4.12.tar.bz2          //解压软件包

                   #cd httpd-2.4.12

                    #./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/use/local/pcre --sysconfdir=/etc/httpd --enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most                           //编译,指定apr,apr-util 和pcre安装路径和模块选择,必须的模块得有so,rewirte ssl,cgi

                   #make

                   #make install

                   #ls /usr/local/apache/bin          //查看bin目录,apachetl是启动脚本

                    ab    checkgid    envvers-std     htdbm    httpd    rotatelogs     apachectl

                   dbmmanage      fcgistarter      htdigest    httxt2dbm   apxs     envvare

                   htcacheclean        htpasswd      logresolve

                 7.启动httpd服务

                   #/usr/local/apache/bin/apachectl start        //启动httpd服务

                   #netstat -anput|grep httpd                           //查看80端口

                   tcp      0      0  :::80            :::*             LISTEN         6211/httpd

                 用浏览器访问默认首页   http:10.10.0.251   结果打开的是欢迎界面,并没有显示it works

                 修改   #vim /etc/httpd/conf/httpd.conf     下的这一项,首页文件路径

                           DocumentRoor "/usr/local/apache/htdocs"

                   再次打开,OK看到了  it   works  !!!

              再此更正一下,在后来启动服务时,会有报错,但是当时却没有,可能是什么地方有其他配置把,现在 说一下报错信息和解决办法:

              报错信息如下:

              httpd: Syntax error on line 144 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_dir.so into server: /usr/local/apache2/modules/mod_dir.so: undefined symbol: apr_array_clear

              总是提示apr的错误,重新编译也不行,后来添加 --with-included-apr参数,在重新编译,并且还要把apr和apr-util的的源码复制到http-2.4.12/srclib目录下才可以

                 #cp  -rf apr-1.5.2 httpd-2.4.12/srclib/apr

                 #cp  -rf apr-util-1.5.4 httpd-2.4.12/srclib/apr-util

             ok ,重新启动就没有问题了

                安装过程中遇到的问题:提示如下,

                util_pcre.c: In function 'ap_regcomp':
                util_pcre.c:128: error: 'PCRE_DUPNAMES' undeclared (first use in this function)
                util_pcre.c:128: error: (Each undeclared identifier is reported only once
                util_pcre.c:128: error: for each function it appears in.)

               问题在于pcre软件没有装上,在make的时候就会有这个提示,安装pcre软件后就可以了

               2. 在选择模块的时候可以使用./configure --help 命令来选择所需要的模块

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


标题名称:apache-httpd-server-创新互联
网站路径:http://jkwzsj.com/article/dhepgh.html

其他资讯