在 Ubuntu 12.04 中安装 Apache 2.4.2 的问题

在 Ubuntu 12.04 中安装 Apache 2.4.2 的问题

我按照以下步骤在 Ubuntu 12.04 中安装 Apache 2.4.2,但似乎没有安装 Apache,下面是我所做的(我按照此网站上的步骤进行操作http://www.discusswire.com/apache-2-4-installation-ubuntu/):

sudo apt-get install build-essential
sudo apt-get build-dep apache2
wget http://apache.mirrors.pair.com/httpd/httpd-2.4.2.tar.gz
tar -xzvf httpd-2.4.2.tar.gz && cd httpd-2.4.2
sudo ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http --with-mpm=prefork
sudo make
sudo make install

当我尝试通过在sudo /usr/local/apache2/bin/apachectl start终端发出命令来启动时,收到以下警告:

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message" and when I typed **top** at terminal, the apache is not there. I also tried to go to <CODE>http://localhost/</CODE> or 127.0.0.1 or even 127.0.1.1 it showed "Can't establish connection to server ..." message. 

PS:我检查了错误日志,结果显示

[Fri Jul 27 15:49:00.703901 2012] [proxy_balancer:emerg] [pid 20781] AH01177: Failed to lookup provider 'shm' for 'slotmem': is mod_slotmem_shm loaded??
[Fri Jul 27 15:49:00.704083 2012] [:emerg] [pid 20781] AH00020: Configuration Failed, exiting

我错过了什么?

答案1

发现这是 httpd 的一个错误,而且很久都没有修复。修复方法如错误中所述,即您需要取消注释 httpd.conf 中的以下行:

#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

答案2

我认为 ServerName 消息不相关。您应该能够通过在 apache 的主配置文件中使用 ServerName 指令指定服务器名称来清除该消息。

你检查过 Apache 的错误日志吗?它们可能会显示一些

答案3

只需在 /etc/apache2/apache2.conf 中添加此行

ServerName yourhostname

或者只需复制此行并粘贴到您的终端并执行:

sudo sh -c "echo \"ServerName $( hostname )\" >> /etc/apache2/apache2.conf"

它会为您完成这项工作,而无需手动编辑您的 apache2.conf。

其次,此行将修复模块问题:

sudo ln -s /etc/apache2/mods-available/mod_slotmem_shm.conf /etc/apache2/mods-enabled/
sudo ln -s /etc/apache2/mods-available/mod_slotmem_shm.load /etc/apache2/mods-enabled/

答案4

您可以使用ppa:rhardy/apache24x在 ubuntu 12.04 中安装 apache 2.4.2 的存储库。

sudo add-apt-repository ppa:rhardy/apache24x
sudo apt-get update
sudo apt-get install apache2

相关内容