Apache反向代理设置SSL证书

发布于 2024-07-09 09:42:53 字数 137 浏览 10 评论 0原文

我们需要在 Apache 反向代理上设置安全证书。 我们被告知需要使用虚拟主机指令。

我在 O'Reilly 的书中查找过这些内容,但找不到任何专门使用 https 的示例。

有谁有任何配置片段的示例来执行此操作?

We need to set up a secure certificate on an Apache reverse proxy.
We've been advised that we need to use a virtual host directive.

I've looked these up in the O'Reilly book bit can't find any examples that pick up https specifically.

Does anyone have any examples of config snippets to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不知所踪 2024-07-16 09:42:53

我不太确定你要什么,但你需要很多东西。 例如,您需要获取 SSL 证书,然后需要将 mod_ssl 安装到 Apache 中。 我建议您使用系统的包管理器等来安装它。

这是一个示例虚拟主机:

<VirtualHost IP.ADDRESS.HERE:443>
   DocumentRoot /web/domain.com/www/htdocs

   ServerName www.domain.com
   ServerAdmin [email protected]

   SSLEngine on
   SSLCertificateFile /usr/local/etc/apache/ssl.crt/www.domain.com.crt
   SSLCertificateKeyFile /usr/local/etc/apache/ssl.key/www.domain.com.key

   ErrorLog "/var/logs/domain.com/error_log"
   CustomLog "|/usr/local/sbin/cronolog /var/logs/domain.com/%Y/%m/access_log" combined
</VirtualHost>

内的代理配置可能看起来不同。 这假设域指向您服务器上的一个目录,但您在 中执行的操作取决于您。

正如我所说,我还必须将 ssl 安装到 Apache 中,以加载我需要以下内容的模块:

LoadModule ssl_module libexec/apache/libssl.so
...
AddModule mod_ssl.c

基本上就是这样。 如果您需要更多指导,请告诉我。 如果您告诉我们您运行的是 Apache 1.3 还是 2.x,也会有所帮助。

I'm not exactly sure what you are asking for, but there are multiple things you need. For example, you need to get a SSL certificate, then you need to install mod_ssl into your Apache. I suggest you install it using your system's package manager, etc..

This is an example virtualhost:

<VirtualHost IP.ADDRESS.HERE:443>
   DocumentRoot /web/domain.com/www/htdocs

   ServerName www.domain.com
   ServerAdmin [email protected]

   SSLEngine on
   SSLCertificateFile /usr/local/etc/apache/ssl.crt/www.domain.com.crt
   SSLCertificateKeyFile /usr/local/etc/apache/ssl.key/www.domain.com.key

   ErrorLog "/var/logs/domain.com/error_log"
   CustomLog "|/usr/local/sbin/cronolog /var/logs/domain.com/%Y/%m/access_log" combined
</VirtualHost>

A proxy configuration inside the <VirtualHost /> can look different. This assumes that the domain points to a directory on your server, but what you do inside <VirtualHost /> is up to you.

As I said, I also had to install ssl into Apache, to load the module I needed the following:

LoadModule ssl_module libexec/apache/libssl.so
...
AddModule mod_ssl.c

And that's basically it. Let me know if you need more pointers. In case, it also helps if you tell us if you run Apache 1.3 or 2.x.

独行侠 2024-07-16 09:42:53

不确定这是否是您想要的,但我过去使用过类似以下内容:

<IfModule mod_ssl.c>
    SSLProxyEngine On
    ProxyPreserveHost On
    RewriteRule ^/whatever(.*)$       https://otherhost/whatever$1  [P]
</IfModule>

我需要代理来自另一台主机的安全内容,这就是我们最终使用的。 效果很好,已经用了一段时间了。 这是否涵盖了您正在寻找的内容?

Not sure if this is what you're after, but I used something like the following in the past:

<IfModule mod_ssl.c>
    SSLProxyEngine On
    ProxyPreserveHost On
    RewriteRule ^/whatever(.*)$       https://otherhost/whatever$1  [P]
</IfModule>

I needed to proxy secure content from another host, and that's what we ended up using. Works fine, and has for some time now. Does that sort of cover what you're looking for?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文