34323 发表于 2016-8-5 08:48:26

编译安装httpd-2.4

编译安装httpd-2.4

编译安装步骤:

    yum groupinstall "Development Tools" "Server Platform Development" -y安装开发环境

    lftp http://archive.apache.org/dist/apr/   下载apr和apr-util
    >mget apr-1.5.2.tar.bz2 apr-util-1.5.3.tar.bz2
    >bye

    ls
    tar xf apr-1.5.2.tar.bz2

    cd apr-1.5.2
    ./configure --prefix=/usr/local/apr
    make && make install

    ls
    tar xf apr-util-1.5.3.tar.bz2
    cd apr-util-1.5.3
    ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
    make && make install

    apr和apr-util就装好了。


前提:
        安装开发环境,安装pcre-devel

    # groupadd -r apache 创建系统组,运行apache的
        # useradd -r -g apache apahce 添加一个系统用户
        # yum install pcre-devel -y
        # lftp http://httpd.apache.org/download.cgi这个我下载不下来,说没有资源,但我可以手动下载,于是用xshell传输到linux上了。
        # mget httpd-2.4.23.tar.bz2
        # tar xf httpd-2.4.23.tar.bz2
        # cd httpd-2.4.23

        # ./configure --prefix=/usr/local/apache --sysconf=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
                # make && make install

        启动服务:
                apachectl

                确保80端口没有其他服务在占用,否则启动不起来,套接字是独占的。
                /usr/local/apache/bin/apachectl 这个命令,不要直接使用apachectl,那是rmp包安装生成的。
                也可以这样:
                        vim /etc/profile.d/httpd.sh
                        export PATH=/usr/local/apache/bin:$PATH把这个位置放前面
                保存退出

                # vim /etc/profile.d/httpd.sh
                # . /etc/profile.d/httpd.sh
                # echo $PATH
                /usr/local/apache/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
                # which apachectl
                /usr/local/apache/bin/apachectl
                #


                # apachectl start
                AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using web1.ams.com. Set the 'ServerName' directive globally to suppress this message

                报错了。。。。
                解决方案:
      killall httpd
      cd /etc/httpd24
      vim httpd.conf
            ServerName web1.ams.com:80把这项启用起来,改为自己的服务器名。
      保存退出,

      # apachectl restart
      # ss -tnl
      80端口已经监听。

      访问下自己的地址:http://192.168.1.117/
      显示:it works!






页: [1]
查看完整版本: 编译安装httpd-2.4