Centos 6.4 安装Apache 2.4.x 无法启动
我以前都可以的,但这次新装的mini centos,也清除了自带的apache,但错误依旧,编译代码:1)清理并更新系统:
rpm -qa|grephttpd
rpm -e httpd
rpm -qa|grep mysql
rpm -e mysql
rpm -qa|grep php
rpm -e php
yum -y remove httpd
yum -y remove php
yum -y remove mysql-server mysql
yum -y remove php-mysql
cd /usr/local/src
wget -c http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
rpm -e libtool-1.5.22-7.el5_4
tar -zxvf libtool-2.4.2.tar.gz
cd libtool-2.4.2
./configure
make
make install
cd ../
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www -s /sbin/nologin
chown -R www:www /home/www
cd /usr/local/src
tar zxvf pcre-8.32.tar.gz
cd pcre-8.32
./configure --prefix=/usr/local/pcre
make && make install
cd /usr/local/src
wget -c http://www.us.apache.org/dist/apr/apr-1.4.6.tar.gz
tar zxvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install
cd /usr/local/src
wget -c http://www.us.apache.org/dist/apr/apr-util-1.5.2.tar.gz
tar zxvf apr-util-1.5.2.tar.gz
cd apr-util-1.5.2
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/ --with-mysql=/usr/local/mysql
make && make install
cd /usr/local/src
tar zxvf httpd-2.4.3.tar.gz
cd httpd-2.4.3
rm -f configure
./buildconf
./configure --prefix=/usr/local/apache \
--enable-headers \
--enable-expires \
--enable-so \
--enable-ssl \
--enable-rewrite \
--enable-deflate \
--enable-mime-magic \
--with-apr=/usr/local/apr/ \
--with-apr-util=/usr/local/apr-util/ \
--with-mysql=/usr/local/mysql \
--with-mpm=prefork \
--disable-userdir \
--enable-lib64 \
--libdir=/usr/lib64 \
--with-zlib \
--with-pcre=/usr/local/pcre/bin/pcre-config \
--disable-cgid \
--disable-cgi
设置开机启动:
echo '/usr/local/apache/bin/apachectl start ' >> /etc/rc.local
添加启动命令:
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
开启、重启、关闭 Apache:
service httpd start
第一次启动提示错误:
service httpd restart
AH00557: httpd: apr_sockaddr_info_get() failed for mgrei.imsyou
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
我修改httpd.conf,将ServerName www.example.com:80 为 ServerName localhost:80
然后再次启动apache,无提示,但页面无法显示,看了下 error_log,错误代码是:
AH00163: Apache/2.4.3 (Unix) configured -- resuming normal operations
AH00094: Command line: '/usr/local/apache/bin/httpd'
AH00173: SIGHUP received.Attempting to restart
AH00163: Apache/2.4.3 (Unix) configured -- resuming normal operations
AH00094: Command line: '/usr/local/apache/bin/httpd'
AH00173: SIGHUP received.Attempting to restart
AH00163: Apache/2.4.3 (Unix) configured -- resuming normal operations
AH00094: Command line: '/usr/local/apache/bin/httpd'
AH00169: caught SIGTERM, shutting down
AH00163: Apache/2.4.3 (Unix) configured -- resuming normal operations
AH00094: Command line: '/usr/local/apache/bin/httpd'
求助大侠们。。。这个该怎么办呐??换了2.4.2 2.4.3 2.4.4 都又这个问题。也试过不用“rm -f configure”这段代码,但问题也依旧。。。 本帖最后由 abcfy2 于 2013-05-19 14:27 编辑
那两行不是报错信息,而是警告,无法通过域名解析到自己的主机名而已,配置ServerName强制指定自己的名字就不会有这个提示了。
AH00557: httpd: apr_sockaddr_info_get() failed for mgrei.imsyou这行是说有selinux,关掉selinux试试,如果能正常访问了,就设置一下上下文,用chcon -R就可以了,具体复制/var/www/html的selinux权限就行了。
http://vbird.dic.ksu.edu.tw/linux_server/0360apache.php#www_basic_start
鸟哥对这个问题有所叙述 在论坛里找个装
apache的帖子吧。
这么简单的一个东西。怎么就搞不起来了呢? 那两行不是报错信息,而是警告,无法通过域名解析到自己的主机名而已,配置ServerName强制指定自己的名字就不会有这个提示了。
AH00557: httpd: apr_sockaddr_info_get() failed for mgrei.imsyou这行是说有selinux,关掉selinux试试,如果能正常访问了,就设置一下上下文,用chcon -R就可以了,具体复制/var/www/html的selinux权限就行了。 我照着LZ的编译参数(不过去掉了几个disable,那个几个参数我有用),完全可以运行,可以看到It works 我的是内网环境,开始启apache的时候,也遇到LZ的问题
解决方法:在httpd.conf中添加ServerName localhost:80 警告信息可以忽略,不用在意
页:
[1]