本文共 2477 字,大约阅读时间需要 8 分钟。
Apache是一个基金会的名字,httpd才是我们要安装的软件包,早期它的名字就叫apache
Apache官网www.apache.org cd /usr/local/src/ wget wget wget apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可以很方便地移植(从linux移植到windows) 2.2的apr和2.4所依赖的apr版本是不一样的。Centos的yum安装的apr和2.4是不匹配的。所以需要自己编译 tar zxvf httpd-2.4.27.tar.gz tar zxvf apr-util-1.5.4.tar.gz tar zxvf apr-1.5.2.tar.gz cd apr-1.6.3 ./configure --prefix=/usr/local/apr make && make installcd /usr/local/src/apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make install cd /usr/local/src/httpd-2.4.27 ./configure \ //这里的反斜杠是脱义字符,加上它我们可以把一行命令写成多行 --prefix=/usr/local/apache2.4 \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --enable-so \ //支持动态扩展模块 --enable-mods-shared=most //绝大多数用到的模块都加载 make && make install /usr/local/apache2.4/bin/apachectl start //启动cd /usr/local/apache2.4/
ls bin/httpd //二进制脚本 bin/httpdls conf/httpd.conf //配置文件
conf/httpd.confls htdocs/ //访问页。默认网站
index.htmlls /usr/local/apache2.4/modules
/usr/local/apache2.4/bin/apachectl -M //apachectl脚本调用了二进制httpd文件 /usr/local/apache2.4/bin/httpd -M //查看加载的模块 so_module (static) //说明是在httpd里面的 http_module (static) mpm_event_module (static) authn_file_module (shared) //说明是扩展模块。是一个可以看到的.so文件在/usr/local/apache2.4/modules/下问题!!make报错
collect2: error: ld returned 1 exit status make[2]: [htpasswd] 错误 1 make[2]: 离开目录“/usr/local/src/httpd-2.4.27/support” make[1]: [all-recursive] 错误 1 make[1]: 离开目录“/usr/local/src/httpd-2.4.27/support” make: *** [all-recursive] 错误 1 解决办法: cd /usr/local/src/ cp -r apr-1.6.2 /usr/local/src/httpd-2.4.27/srclib/apr cd apr-1.6.3 ./configure --prefix=/usr/local/apr make && make install cp -r apr-util-1.6.0 /usr/local/src/httpd-2.4.27/srclib/apr-util cd /usr/local/src/apr-util-1.5.4 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make installcd /usr/local/src/httpd-2.4.27
#./configure --with-included-apr --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most #make &&make install错误!!
1.xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录 #include <expat.h> 解决办法: [root@lsx-02 apr-util-1.6.0]# yum list |grep 'expat.'2.configure: error: no acceptable C compiler found in $PATH
yum install -y gcc3.configure: error: pcre-config for libpcre not found. PCRE is required and available from
yum list |grep -i PCRE yum install -y pcre-devel.x86_64本文转自 虾米的春天 51CTO博客,原文链接:http://blog.51cto.com/lsxme/2050916,如需转载请自行联系原作者