如何为 Apache httpd 安装 mod_ssl? [英] How to install mod_ssl for Apache httpd?
问题描述
好的
所以我不久前安装了 Apache httpd
,最近又回来尝试设置 SSL 并让它为多个不同的 tomcat 服务器提供服务.
So I installed Apache httpd
a while ago and have recently come back to it to try setup SSL and get it serving several different tomcat servers.
目前我有两个完全独立的 Tomcat 实例,分别为稍微不同的版本(一个用于开发,一个用于演示)我的 Web 应用程序提供给两个不同的端口:
At the moment I have two completely separate Tomcat instances serving up to slightly different versions (one for dev and one for demo say) my web app to two different ports:
example.com:8081
example.com:8082
我已经成功(回到 1 月)使用 mod_jk
获取 httpd
来为 http://www.example.com 提供相同的 Tomcat 实例:8090/dev
和 http://www.example.com:8090/demo
(8090 因为我在这个阶段通过 Jetty 在 8080 上运行了另一个应用程序)使用以下命令httpd.conf
中的代码:
I've successfully (back in Jan) used mod_jk
to get httpd
to serve those same Tomcat instances to http://www.example.com:8090/dev
and http://www.example.com:8090/demo
(8090 cos I've got another app running on 8080 via Jetty at this stage) using the following code in httpd.conf
:
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug
<VirtualHost *:8090>
JkMount /devd* tomcatDev
JkMount /demo* tomcatDemo
</VirtualHost>
我不想做的是启用 SSL.
What I'm not trying to do is enable SSL.
我已将以下内容添加到 httpd.conf
:
I've added the following to httpd.conf
:
Listen 443
<VirtualHost _default_:443>
JkMount /dev* tomcatDev
JkMount /demo* tomcatDemo
SSLEngine on
SSLCertificateFile "/opt/httpd/conf/localhost.crt"
SSLCertificateKeyFile "/opt/httpd/conf/keystore.key"
</VirtualHost>
但是当我尝试使用 apachectl restart
重新启动 Apache 时(是的,在关闭我提到的其他应用程序后,它不会玩弄 https 连接)我不断收到错误:
But when I try to restart Apache with apachectl restart
(yes after shutting down that other app I mentioned so it doesn't toy with https connections) I continuously get the error:
无效的命令SSLEngine",可能是服务器配置中未包含的模块拼写错误或定义的.httpd 未运行,正在尝试启动
Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration. httpd not running, trying to start
我查看了 httpd/modules
目录,确实没有 mod_ssl
,只有 mod_jk.so
和 httpd.exp
.
I've looked in the httpd/modules
dir and indeed there is no mod_ssl
, only mod_jk.so
and httpd.exp
.
我试过用 yum 安装 mod_ssl
,它说它已经安装了.事实上,我可以在 /usr/lib/httpd/modules
中找到 mod_ssl.so
但这不是我安装 httpd
的路径这是 /opt/httpd
而实际上 /usr/lib/httpd
只包含 modules
目录.
I've tried using yum to install mod_ssl
, it says its already installed. Indeed I can locate mod_ssl.so
in /usr/lib/httpd/modules
but this is NOT the path to where I've installed httpd
which is /opt/httpd
and in fact /usr/lib/httpd
contains nothing but the modules
dir.
谁能告诉我如何为 httpd
的安装位置正确安装 mod_ssl
以便我可以克服这个错误?
Can anyone tell me how to install mod_ssl
properly for my installed location of httpd
so I can get past this error?
推荐答案
是否还有其他 LoadModule
命令引用了 /usr/lib/httpd/modules
文件夹中的模块?如果是这样,您只需将 LoadModule ssl_module/usr/lib/httpd/modules/mod_ssl.so
添加到您的 conf 文件即可.
Are any other LoadModule
commands referencing modules in the /usr/lib/httpd/modules
folder? If so, you should be fine just adding LoadModule ssl_module /usr/lib/httpd/modules/mod_ssl.so
to your conf file.
否则,您需要将 mod_ssl.so
文件复制到加载其他模块的任何目录并在那里引用它.
Otherwise, you'll want to copy the mod_ssl.so
file to whatever directory the other modules are being loaded from and reference it there.
这篇关于如何为 Apache httpd 安装 mod_ssl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!