【问题标题】:Configure Apache web server to call a app https url配置 Apache Web 服务器以调用应用程序 https url
【发布时间】:2020-05-29 22:45:34
【问题描述】:

早安,

我有一个 Apache 服务器 (10.8.111.67),我将它配置为 ProxyPass 到我的应用服务器 http 端口 (10.8.1.63),它的工作。我在 httpd.conf 中做的事情如下:

ProxyPass "/mfp" "http://10.8.1.63:9080/mfp"
ProxyPassReverse "/mfp" "http://10.8.1.63:9080/mfp"

但是,我应该代理传递给 https url 而不是 http。

我google了一下,发现需要在ssl.conf中配置一些东西,下面是我打算做的:

<VirtualHost 10.8.111.67:80>
SSLEngine on
SSLCertificateFile ???
SSLCertificateKeyFile ???
ProxyPass "/mfp" "http://10.8.1.63:9080/mfp"
ProxyPassReverse "/mfp" "http://10.8.1.63:9080/mfp"
</VirtualHost>

我不确定我应该为SSLCertificateFile 放置什么证书,它是来自应用服务器的证书吗?可以用openssl命令下载吗?

对于SSLCertificateKeyFile,我应该在里面放什么文件?来自应用服务器的私钥?我可以知道如何从 Web 服务器生成私钥吗?我运行 ssh-keygen,得到了 id_rsa.pubid_rsa

请多多指教。

如果我做错了什么,请通知我。

【问题讨论】:

    标签: apache https webserver httpd.conf proxypass


    【解决方案1】:

    您不需要在 virtualhost 中配置证书只是为了代理到 SSL 后端。

    要反向代理到 SSL 后端,您只需要确保 mod_ssl 已加载 并且您有指令:SSLProxyEngine on 让反向代理执行此操作到 SSL 后端。

    在virtualhost中加载证书适用于监听SSL连接的virtualhosts,主要是443端口的virtualhosts。

    因此,根据您对 SSL 后端的反向代理的描述,除了加载您想要的 mod_ssl 模块之外:

    <VirtualHost 10.8.111.67:80>
        ServerName youshouldefinethisalways.example.com
        SSLProxyEngine on
        ProxyPass /mfp https://backend-server.example.com/mfp
        ProxyPassReverse /mfp https://backend-server.example.com/mfp 
    </VirtualHost>
    

    【讨论】:

    • 嗨,Ezra,我刚试过,但遇到错误 500。错误日志显示我遇到了 502。我将 serverName 作为 ip 和端口号,可以吗?
    • 只要名字解析,查看错误日志寻找线索。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-12
    • 2016-04-10
    • 2020-10-30
    • 1970-01-01
    • 2010-11-10
    • 2021-01-22
    相关资源
    最近更新 更多