apache 安装

来源:互联网 发布:js中top 编辑:程序博客网 时间:2024/06/07 12:46
1.下载 apache
http://mirror.bit.edu.cn/apache/httpd/
 
2.安装编译依赖包
yum install -y zlib-devel pcre pcre-devel apr apr-devel gcc
3.解压 编译 apche
# tar zxf httpd-2.2.31.tar.gz
# cd httpd-2.2.31
# ./configure \
--prefix=/usr/local/apache2 \--with-included-apr \--enable-so \--enable-deflate=shared \--enable-expires=shared \--enable-rewrite=shared \--with-pcre
# make && make install
4.启动
# /usr/local/apache2/bin/apachectl start
报错:
httpd: apr_sockaddr_info_get() failed for shiwei
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

原因:这个问题应该是没有在 /etc/httpd/conf/httpd.conf 中设定 ServerName。所以apache会用主机上的名称来取代,首先会去找 /etc/hosts 中有没有主机的定义。

解决办法:

(1)可以设定httpd.conf文件中的 ServerName,如下:ServerName localhost:80                        

(2)在 /etc/hosts 中填入自己的主机名称 bogon,如下:127.0.0.1 shiwei (用户名称)

报错:
/usr/local/apache2/bin/apachectl: line 78: 17303 Segmentation fault (core dumped) $HTTPD -k $AR
解决:
重装 apache
5.选项:
1)列出静态模块
/usr/local/apache2/bin/apachectl -M
动态模块在 /apache2/modules/ 目录下
静态模块在 /apache2/bin/httpd 里面
2)列出静态模块 .c
/usr/local/apache2/bin/apachectl -l
3)测试配置文件
/usr/local/apache2/bin/apachectl -t
4)load 配置文件
/usr/local/apache2/bin/apachectl graceful
0 0
原创粉丝点击