歡迎您光臨本站 註冊首頁

Centos 6.4 安裝Apache 2.4.x 無法啟動

←手機掃碼閱讀     火星人 @ 2014-03-03 , reply:0

Centos 6.4 安裝Apache 2.4.x 無法啟動

我以前都可以的,但這次新裝的mini centos,也清除了自帶的apache,但錯誤依舊,編譯代碼:
1)清理並更新系統:

rpm -qa|grep  httpd
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」這段代碼,但問題也依舊。。。
《解決方案》

在論壇里找個裝
apache的帖子吧。
這麼簡單的一個東西。怎麼就搞不起來了呢?
《解決方案》

那兩行不是報錯信息,而是警告,無法通過域名解析到自己的主機名而已,配置ServerName強制指定自己的名字就不會有這個提示了。
AH00557: httpd: apr_sockaddr_info_get() failed for mgrei.imsyou這行是說有selinux,關掉selinux試試,如果能正常訪問了,就設置一下上下文,用chcon -R就可以了,具體複製/var/www/html的selinux許可權就行了。
《解決方案》

本帖最後由 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
鳥哥對這個問題有所敘述
《解決方案》

我照著LZ的編譯參數(不過去掉了幾個disable,那個幾個參數我有用),完全可以運行,可以看到It works
《解決方案》

我的是內網環境,開始啟apache的時候,也遇到LZ的問題

解決方法:在httpd.conf中添加ServerName localhost:80
《解決方案》

警告信息可以忽略,不用在意

[火星人 ] Centos 6.4 安裝Apache 2.4.x 無法啟動已經有2157次圍觀

http://coctec.com/docs/service/show-post-296.html