• 安装apache2.4.10


     

    一:依赖安装:apache依赖于apr,apr-util,pcre,所以需要先安装他,并且需要最新的

    apr官网:http://apr.apache.org/download.cgi

    pcre官网:http://www.pcre.org/

     

    apr,apr-util 与 apache的关系:

    http://www.cnblogs.com/Alight/p/3997777.html

    apache与pcre的关系:

    PCRE被广泛使用在许多开源软件之中最著名的莫过于Apache HTTP服务器和PHP脚本语言R脚本语言此外正如从其名字所能看到的PCRE也是perl语言的缺省正则库
    PCRE是用C语言实现的其C++实现版本是PCRE++

     

    今日编译apache时出错:

    #./configure --prefix……检查编辑环境时出现:

    checking for APR... no
    configure: error: APR not found . Please read the documentation

    解决办法:

    1.下载所需软件包:


    wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
    wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
    wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip

    2.编译安装:


    yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs

    具体步骤如下:

    a:解决apr not found问题>>>>>>


    [root@xt test]# tar -zxf apr-1.4.5.tar.gz
    [root@xt test]# cd apr-1.4.5
    [root@xt apr-1.4.5]# ./configure --prefix=/usr/local/apr
    [root@xt apr-1.4.5]# make && make install

    b:解决APR-util not found问题>>>>


    [root@xt test]# tar -zxf apr-util-1.3.12.tar.gz
    [root@xt test]# cd apr-util-1.3.12
    [root@xt apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config
    [root@xt apr-util-1.3.12]# make && make install


    c:解决pcre问题>>>>>>>>>


    [root@xt test]#unzip -o pcre-8.10.zip
    [root@xt test]#cd pcre-8.10
    [root@xt pcre-8.10]#./configure --prefix=/usr/local/pcre
    [root@xt pcre-8.10]#make && make install

    4.最后编译Apache时加上:

    --with-apr=/usr/local/apr

    --with-apr-util=/usr/local/apr-util/

    --with-pcre=/usr/local/pcre

    成功编译完成~

     

    二:编译Apache

      [root@yahoo httpd-2.3.12-beta]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/  --with-pcre=/usr/local/pcre

     [root@yahoo httpd-2.3.12-beta]# make
     [root@yahoo httpd-2.3.12-beta]# make install

    [root@yahoo httpd-2.3.12-beta]# /usr/local/apache2/bin/apachectl start

    三:把apache加到系统服务里去

    Apache加入启动项里面:

    echo '/usr/local/apache2/bin/apachectl start ' >> /etc/rc.local


    Apache加入到系统服务里面:
    cp /安装目录下/apache/bin/apachectl /etc/rc.d/init.d/httpd  (init.d中的脚本就相当于window中的注册表,在系统启动的时候某些指定的脚本被执行)
    修改httpd
    在文件头部加入如下内容:
    ###
    # Comments to support chkconfig on RedHat Linux
    # chkconfig: 2345 90 90
    # description:http server
    ###
    保存
    在打入
    #chkconfig --add httpd
    #chkconfig --level 345 httpd on

    参考:

    http://www.111cn.net/sys/linux/49030.htm

    http://blog.csdn.net/kobe_lzq/article/details/7976787

    linux 下 apache启动、停止、重启命令

    基本的操作方法:
    本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况

    apahce启动命令:
    推荐/usr/local/apache2/bin/apachectl start apaceh启动

    apache停止命令
    /usr/local/apache2/bin/apachectl stop   停止

    apache重新启动命令:
    /usr/local/apache2/bin/apachectl restart 重启

    要在重启 Apache 服务器时不中断当前的连接,则应运行:

    /usr/local/sbin/apachectl graceful

    如果apache安装成为linux的服务的话,可以用以下命令操作:

    service httpd start 启动

    service httpd restart 重新启动

    service httpd stop 停止服务

    Linux系统为Ubuntu

    一、Start Apache 2 Server /启动apache服务

    # /etc/init.d/apache2 start
    or
    $ sudo /etc/init.d/apache2 start

    二、 Restart Apache 2 Server /重启apache服务

    # /etc/init.d/apache2 restart
    or
    $ sudo /etc/init.d/apache2 restart

    三、Stop Apache 2 Server /停止apache服务

    # /etc/init.d/apache2 stop
    or
    $ sudo /etc/init.d/apache2 stop

    错误类型:

    错误一:启动apache遇到错误:httpd: Could not reliably determine the server's fully qualified domain name


    [root@server httpd-2.2.4]# /usr/local/apache/bin/apachectl start
    httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
     
    1)进入apache的安装目录:(视个人安装情况而不同) [root@server ~]# cd /usr/local/apache/conf
     
    2)编辑httpd.conf文件,搜索"#ServerName",添加ServerName localhost:80
    [root@server conf]# ls
    extra  httpd.conf  magic  mime.types  original
    [root@server conf]# vi httpd.conf
    #ServerName www.example.com:80
    ServerName localhost:80
    3)再重新启动apache 即可。
    [root@server ~]# /usr/local/apache/bin/apachectl restart

  • 相关阅读:
    python类型转换
    手机抓包
    java容器collection的一些简单特点
    WIN7 如何将BAT文件附加到任务栏
    Android新权限机制 AppOps
    记录一写Android常用API
    关于java建立的的包import的问题
    Android组件安全
    查看字节码
    数据库分表之Mybatis+Mysql实践(含部分关键代码)
  • 原文地址:https://www.cnblogs.com/Alight/p/3990956.html
Copyright © 2020-2023  润新知