Apache2.4.x在RHEL6.4上手动构建和安装
操作系统:Red Hat Enterprise Linux Server 6.4版(圣地亚哥) 此操作系统上当前安装的apache是2.2.15。我需要最新的2.4.x分支,因此已经开始手动安装它。我已经注意到了我执行的完整过程,包括事先将Apache2.4.x在RHEL6.4上手动构建和安装,apache,apache2,redhat,rhel,Apache,Apache2,Redhat,Rhel,操作系统:Red Hat Enterprise Linux Server 6.4版(圣地亚哥) 此操作系统上当前安装的apache是2.2.15。我需要最新的2.4.x分支,因此已经开始手动安装它。我已经注意到了我执行的完整过程,包括事先将apr和apr util源代码解包到apache源代码中,但我想以下是过程中最重要的部分: GATHER LATEST APACHE AND APR $ cd ~ $ mkdir apache-src $ cd apache-src $ wget http:/
apr
和apr 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\u global\u mutex\u create
)
我漏了一步吗?虽然我在谷歌上发现了部分错误,但大多数解决方案都围绕着。因此文件无法访问。这似乎不是问题,模块出现在/etc/http/modules
中
注意:在运行上述命令时,/etc/http
为空
你有正确的程序,但不完整
安装后,必须在httpd.conf中启用SSL。并生成server.crt和server.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
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
/usr/local/apache2/bin/apachectl start
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.编译
cd /usr/src
wget http://www.apache.org/dist/httpd/httpd-2.4.23.tar.gz
tar xvf httpd-2.4.23.tar.gz
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
/usr/local/apache2/bin/apachectl start
正如您在/configure
命令中所看到的,我们指定了包含apr和apr UTIL的命令行选项
4。在httpd.conf中启用SSL
Apache配置文件httpd.conf位于/usr/local/apache2/conf下
取消注释/usr/local/apache2/conf/httpd.conf文件中的httpd-ssl.conf Include行和LoadModule ssl\u module
行:
查看httpd-ssl.conf以查看所有默认ssl配置
在大多数情况下,您不需要修改此文件中的任何内容
nano /usr/local/apache2/conf/extra/httpd-ssl.conf
启动Apache之前需要SSL证书和密钥
在继续之前,需要创建httpd-ssl.conf中提到的server.crt和server.key文件
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文件
cd /usr/src
wget http://www.apache.org/dist/httpd/httpd-2.4.23.tar.gz
tar xvf httpd-2.4.23.tar.gz
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
/usr/local/apache2/bin/apachectl start
首先,使用openssl生成server.key
cd /usr/src
openssl genrsa -des3 -out server.key 1024
上述命令将要求输入密码。请确保记住此密码。稍后启动Apache时需要使用此选项
接下来,使用上面的server.key文件生成一个证书请求文件(server.csr)
最后,使用上述server.key和server.csr文件生成一个自签名ssl证书(server.crt)
将server.key和server.crt文件复制到适当的Apache配置目录位置
cp server.key /usr/local/apache2/conf/
cp server.crt /usr/local/apache2/conf/
6。启动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
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
/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中取消注释如下所示的行:
最后,这将提示您在启动apache之前输入私钥的密码。
验证apachehttpd进程是否在后台运行
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端口上运行。打开web浏览器并验证是否可以使用https://{your ip address}访问Apache
我希望这有帮助,否则我建议你去看看:
如果/configure
如何使用服务器自动启动?@AntoineSubit Great post中未指定-with included apr util
,则在make
步骤中会收到此错误。我为RedHat遵循了它,它工作得很好。只需在步骤3中进行一个小的修正。编译/configure--enable so--enable ssl--with mpm=prefork--with included apr--with included apr util
@Capricorn谢谢。我用你的更正编辑了我的答案你有问题的解决方案吗