apache Apache反向代理设置SSL证书
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/283636/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Apache reverse proxy set up SSL certificate
提问by alimack
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.
我们需要在 Apache 反向代理上设置安全证书。我们被告知需要使用虚拟主机指令。
I've looked these up in the O'Reilly book bit can't find any examples that pick up https specifically.
我已经在 O'Reilly 的书中查找了这些,但找不到任何专门获取 https 的示例。
Does anyone have any examples of config snippets to do this?
有没有人有任何配置片段的例子来做到这一点?
回答by Till
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..
我不确定您要什么,但是您需要很多东西。例如,您需要获得 SSL 证书,然后您需要将 mod_ssl 安装到您的 Apache 中。我建议您使用系统的包管理器等安装它。
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.
里面的代理配置<VirtualHost />可以看起来不同。这假设域指向您服务器上的目录,但您在内部做什么<VirtualHost />取决于您。
As I said, I also had to install ssl into Apache, to load the module I needed the following:
正如我所说,我还必须将 ssl 安装到 Apache 中,以加载我需要以下内容的模块:
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.
基本上就是这样。如果您需要更多指示,请告诉我。如果您告诉我们您运行的是 Apache 1.3 还是 2.x,它也会有所帮助。
回答by f4nt
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 [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?
我需要从另一台主机代理安全内容,这就是我们最终使用的。工作正常,并且已经有一段时间了。这是否涵盖了您正在寻找的内容?

