首页 文章

apache反向代理hhtps

提问于
浏览
0

设置apache反向代理客户端==>代理==>服务器

这是在我本地的Windows机器上进行测试,在我的主机文件中设置了一个条目,将代理dns映射到127.0.0.1

httpd.conf

<VirtualHost *:443>
     ServerName <proxy Server>
     SSLEngine On
     SSLProxyEngine On
     ProxyRequests Off
     ProxyPreserveHost On
     <Proxy *>
        Order deny,allow
        Allow from all
     </Proxy>
     SSLCertificateFile "<cert for proxy server>"
     SSLCertificateKeyFile "<key for proxy server>"
     ProxyPass /  https://appserver.com/
     ProxyPassReverse /  https://appserver.com/
</VirtualHost>

启动时我没有在error.log中看到任何错误 . 当我发出请求https://proxy.com时,access.log或error.log中没有条目 .

任何人都可以在配置中看到问题或提出一些想法吗?谢谢Rahul

2 回答

  • 0

    您只需要以下内容来执行SSL代理:

    <VirtualHost *:443>
         ServerName <proxy Server>
         SSLEngine On
         ProxyPass "/"  "http://www.example.com/"
         ProxyPassReverse "/"  "http://www.example.com/"
         SSLCertificateFile "<cert for proxy server>"
         SSLCertificateKeyFile "<key for proxy server>"
    </VirtualHost>
    

    其他的东西是不必要的 .

  • 0

    好吧,所以它终于奏效了 . 从头开始1.在httpd.conf中添加了对端口80已有的Listen 443(Listen 80)2 . 逐个启用模块

    LoadModule ssl_module modules/mod_ssl.so
    LoadModule proxy_http_module modules/mod_proxy_http.so 
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule ssl_module modules/mod_ssl.so
    

    3.在httpd.conf中取消注释httpd-vhosts.conf 4.在httpd-vhosts.conf中添加以下内容

    <VirtualHost *:443>
    ServerAdmin xyz@mail.com
    DocumentRoot "c:/Apache24/htdocs"
    ServerName <proxy Server>
    ErrorLog "c:/Apache24/logs/error-ssl.log"
    CustomLog "c:/Apache24/logs/access-ssl.log" common
    ProxyRequests Off
    ProxyPreserveHost Off
    SSLProxyEngine On
    SSLEngine on
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    
     SSLCertificateFile "<cert for proxy server>"
     SSLCertificateKeyFile "<Key for proxy server>"
    
    ProxyPass /  https://appserver.com/
    ProxyPassReverse / https://appserver.com/
    </VirtualHost>
    

    它开始工作了 . 曾经尝试了很多这样的事情并且有很多变化,从一开始就有意义 . 大部分都缺少httpd.conf文件中的Listen 443

相关问题