2013-11-21 29 views
14

OS:紅帽企業Linux服務器版本6.4(聖地亞哥)的Apache 2.4.x的手動安裝在RHEL 6.4 - 沒有Apache模塊將在啓動加載

這個操作系統目前百勝安裝的Apache 2.2.15是。我需要最新的2.4.x分支,所以已經手動安裝它了。我注意到我承諾,包括拆包aprapr-util源到事先在Apache源的完整過程,但我想下面是過程中最重要的部分:

GATHER LATEST APACHE AND APR 
$ cd ~ 
$ mkdir apache-src 
$ cd apache-src 
$ wget http://apache.insync.za.net//httpd/httpd-2.4.6.tar.gz 
$ tar xvf httpd-2.4.6.tar.gz 
$ cd httpd-2.4.6 
$ cd srclib 
$ wget http://apache.insync.za.net//apr/apr-1.5.0.tar.gz 
$ tar -xvzf apr-1.5.0.tar.gz 
$ mv apr-1.5.0 apr 
$ rm -f apr-1.5.0.tar.gz 
$ wget http://apache.insync.za.net//apr/apr-util-1.5.3.tar.gz 
$ tar -xvzf apr-util-1.5.3.tar.gz 
$ mv apr-util-1.5.3 apr-util 

INSTALL DEVEL PACKAGES 
yum update --skip-broken (There is a dependency issue with the latest Chrome needing the latest libstdc++, which is not available for RHEL and CentOS) 
yum install apr-devel 
yum install apr-util-devel 
yum install pcre-devel 

INSTALL 
$ cd ~/apache-src/httpd-2.4.6 
$ ./configure --prefix=/etc/httpd --enable-mods-shared="all" --enable-rewrite --with-included-apr 
$ make 
$ make install 

注:在時間運行上面的,/etc/http是空的。

這似乎一直很好,直到我嘗試啓動httpd服務。似乎每個模塊包括httpd.conf失敗與mod_rewrite類似這樣的消息:

httpd: Syntax error on line 148 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_rewrite.so into server: /etc/httpd/modules/mod_rewrite.so: undefined symbol: ap_global_mutex_create 

我在httpd.conf右走過啓用的模塊列表,並評論他們出一次一個。所有觸發錯誤如上,但「未定義的符號:值」通常是不同的(所以不總是ap_global_mutex_create)。

我錯過了一個步驟嗎?雖然我在Google上發現了這個錯誤的一部分,但大部分解決方案圍繞着.so文件無法訪問。這似乎並不是一個問題,模塊出現在/etc/http/modules中。

注意:在上面運行時,/etc/http是空的。

回答

23

你有正確的程序,但它是不完整的。

安裝完成後,您必須在httpd.conf中啓用SSL。並生成server.crtserver.key文件。 之下的整個過程:

1.下載Apache

cd /usr/src 
wget http://www.apache.org/dist/httpd/httpd-2.4.23.tar.gz 
tar xvf httpd-2.4.23.tar.gz 

2.下載APR和APR-的Util

cd /usr/src 
wget -c http://mirror.cogentco.com/pub/apache/apr/apr-1.5.2.tar.gz 
wget -c http://mirror.cogentco.com/pub/apache/apr/apr-util-1.5.4.tar.gz 
tar xvf apr-1.5.2.tar.gz 
tar xvf apr-util-1.5.4.tar.gz 

現在把APR和APR-的Util您下載到你的apache源文件中。

mv apr-1.5.2 /usr/src/httpd-2.4.23/srclib/apr 
mv apr-util-1.5.4 /usr/src/httpd-2.4.23/srclib/apr-util 

3.Compile

cd /usr/src/httpd-2.4.23 
./configure --enable-so --enable-ssl --with-mpm=prefork --with-included-apr --with-included-apr-util 
make 
make install 

正如你可以在./configure命令,我們指定命令行選項,包括APR和APR-utils的看到。

4.在httpd中啓用SSL。CONF

Apache配置文件的httpd.conf位於下的/ usr /本地/ apache2的/ CONF

nano /usr/local/apache2/conf/httpd.conf 

取消對的httpd-ssl.conf中包括線路,並在/usr/local/apache2/conf/httpd.conf文件LoadModule ssl_module行:

# LoadModule ssl_module modules/mod_ssl.so 
# Include conf/extra/httpd-ssl.conf 

查看httpd-ssl.conf查看所有默認的SSL配置。
對於大多數情況下,您不需要修改此文件中的任何內容。

nano /usr/local/apache2/conf/extra/httpd-ssl.conf 

在啓動Apache之前,需要SSL證書和密鑰。
server.crt and server.key中提到的文件需要在我們前進之前創建httpd-ssl.conf

cd /usr/local/apache2/conf/extra 
egrep 'server.crt|server.key' httpd-ssl.conf 

SSLCertificateFile "/usr/local/apache2/conf/server.crt" 
SSLCertificateKeyFile "/usr/local/apache2/conf/server.key" 

5.生成server.crt這和server.key文件

首先,生成server.key使用OpenSSL的。

cd /usr/src 
openssl genrsa -des3 -out server.key 1024 

上面的命令將要求輸入密碼。確保記住這個密碼。稍後啓動Apache時需要這些。

接着,生成使用上述server.key文件證書請求文件(server.csr)。

openssl req -new -key server.key -out server.csr 

最後,生成使用上述server.keyserver.csr文件的自簽名證書(server.crt這)。

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt 

複製server.keyserver.crt這文件到相應的Apache配置目錄位置。

cp server.key /usr/local/apache2/conf/ 
cp server.crt /usr/local/apache2/conf/ 

6.啓動Apache

/usr/local/apache2/bin/apachectl start 

如果您收到以下錯誤信息:

AH00526: Syntax error on line 51 of /usr/local/apache2/conf/extra/httpd-ssl.conf: 
Invalid command 'SSLCipherSuite', perhaps misspelled or defined by a module not included in the server configuration 

確保取消註釋的httpd如下所示的線。CONF

vi /usr/local/apache2/conf/httpd.conf 

# LoadModule socache_shmcb_module modules/mod_socache_shmcb.so 

最後,這將提示您啓動了Apache之前,你的私鑰輸入密碼。 驗證Apache httpd進程是否在後臺運行。

ps -ef | grep http 

您應該看到類似的東西:

root 29529 1  0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start 
antoine 29530 29529 0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start 
antoine 29531 29529 0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start 
antoine 29532 29529 0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start 
root 29616 18260 0 13:09 pts/0 00:00:00 grep http 

通過默認的Apache SSL 443端口上運行。打開網頁瀏覽器,並驗證您可以使用Apache的HTTPS訪問:// {您的IP地址的}

我希望這種幫助,否則我建議你去看看:http://jasonpowell42.wordpress.com/2013/04/05/install-apache-2-4-4-on-centos-6-4/

+0

如何使其自動啓動服務器?make步驟中收到此錯誤。 – vee

+0

對於汽車戰略請參閱此鏈接:http://serverfault.com/a/202886 –

+1

@AntoineSubit偉大的職位。我遵循它爲RedHat,它運作良好。只是在步驟3中稍作修改。編譯'./configure --enable-so --enable-ssl --with-mpm = prefork --with-included-apr --with-included-apr-util' – Capricorn

2
baprutil-1.la /usr/src/httpd-2.4.27/srclib/apr/libapr-1.la -lrt -lcrypt -lpthread -ldl -lcrypt 
/usr/src/httpd-2.4.27/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_GetErrorCode' 
/usr/src/httpd-2.4.27/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler' 
/usr/src/httpd-2.4.27/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_ParserCreate' 
/usr/src/httpd-2.4.27/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_SetCharacterDataHandler' 
/usr/src/httpd-2.4.27/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_ParserFree' 
/usr/src/httpd-2.4.27/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_SetUserData' 
/usr/src/httpd-2.4.27/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_StopParser' 
/usr/src/httpd-2.4.27/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_Parse' 
/usr/src/httpd-2.4.27/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_ErrorString' 
/usr/src/httpd-2.4.27/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_SetElementHandler' 
collect2: error: ld returned 1 exit status 
make[2]: *** [htpasswd] Error 1 
make[2]: Leaving directory `/usr/src/httpd-2.4.27/support' 
make[1]: *** [all-recursive] Error 1 
make[1]: Leaving directory `/usr/src/httpd-2.4.27/support' 
make: *** [all-recursive] Error 1 

如果沒有指定--with-included-apr-util./configure