zoukankan      html  css  js  c++  java
  • apache源码编译安装详解

            查看是否安装 rpm -qa httpd
            如果已安装,则卸载:rpm -e 卸载  --nodeps 不考虑意外
            下载 wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.gz
                查看大小 ll -sh
            解压 tar xvf
            查看文件readme、install以了解该软件安装方式。
            编译环境部署及若干参数解析:
                ./configure
                --prefix=/application/apache2.2.31  //安装的目录
                --enable-deflate //压缩  对文本压缩
                --enable-expires //过期  浏览器缓存多久
                --enable-headers //激活头
                --enable-modules //激活大多数模块
                --enable-so      //
                --with-mpm=worker //由进程生成的线程(worker)提供服务
                --enable-rewrite  //激活rewrite功能(伪静态)
                
                查看错误:echo $? 或error
                configure: error: in `/root/httpd-2.2.31/srclib/apr':
                configure: error: no acceptable C compiler found in $PATH
                See `config.log' for more details
                configure failed for srclib/apr
                    解决办法:yum -y install gcc
                再次检查部署环境,还有错误
                checking for zlib location... not found
                checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
                    解决办法:yum -y install zlib-devel
            make
            make install
            创建软链接:ln -sv apache2.2.31 apache
            查看安装目录 ls          (emeditor软件)
            检查语法:/application/apache/bin/apachectl -t
            启动:/application/apache/bin/apachectl start
                或:/application/apache/bin/httpd -k start
            存在以下错误,不过没关系:
                httpd: apr_sockaddr_info_get() failed for min
                httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
            
            查看是否启动:lsof -i :80    或 ps -ef | grep httpd
            root     30976     1  0 07:51 ?        00:00:00 /application/apache2.2.31/bin/httpd -k start
            daemon   30977 30976  0 07:51 ?        00:00:00 /application/apache2.2.31/bin/httpd -k start
            daemon   30978 30976  0 07:51 ?        00:00:00 /application/apache2.2.31/bin/httpd -k start
            daemon   30979 30976  0 07:51 ?        00:00:00 /application/apache2.2.31/bin/httpd -k start
            daemon   30980 30976  0 07:51 ?        00:00:00 /application/apache2.2.31/bin/httpd -k start
            root     31064  1464  0 07:54 pts/0    00:00:00 grep httpd
            从结果来看已经启动。
            
            在浏览器上访问主机ip,显示 It works!
            
            如果错误,按照以下方式检查:
                1、检查iptables防火墙
                2、检查selinux getenforce
                3、检查端口 80
                4、检查进程
                5、wget或curl
            
            查看已经生效的模块:/application/apache/bin/apachectl -l
                重点查看以下模块:
                    /application/apache/bin/apachectl -l|egrep "so|rewrite|header|expire|deflate"
                        mod_deflate.c
                        mod_expires.c
                        mod_headers.c
                        mod_rewrite.c
                        mod_so.c
                    
            跟踪进程使用情况 strace
                strace /application/apache/bin/apachectl -M
        
        部署站点:
            cd /application/apache
            cd conf/    //查看配置文件
            grep -i documentroot httpd.conf    //查看网站的根目录
                DocumentRoot "/application/apache2.2.31/htdocs"
            进入网站的根目录,放入网站文件
            刷新浏览器,成功。

  • 相关阅读:
    第一次的作业
    第02组 Alpha冲刺(2/4)
    团队项目选题报告
    第一次个人编程作业
    第二次结对编程作业
    胖子的故事(四)
    关于博客园的聚合问题
    blog是写给谁看的
    ASP.NET Forms 身份验证
    要努力了!
  • 原文地址:https://www.cnblogs.com/tianyik/p/5301940.html
Copyright © 2011-2022 走看看