Apache 处理 SSL 请求并将其传递给 HAproxy

发布于 2024-07-15 03:57:49 字数 271 浏览 5 评论 0原文

我正在尝试设置为前端反向代理,并使用 Haproxy 将请求转发到后端的 Apache Web 服务器。 我的问题是我未能成功地使用 Apache 处理 SSL 请求。

我知道 Haproxy 无法处理 SSL 请求,因此我尝试设置 Apache 以接受端口 443 上的客户端请求并将其转发到 Haproxy,然后 Haproxy 会拾取请求并将其转发到正确的 Apache 后端 Web 服务器。 有人成功做到这一点吗? 如果是的话,您能提供 Apache 和 Haproxy 配置的示例吗?

I am trying to set up as a front end reverse proxy with Haproxy forwarding requests to Apache web servers in the back end. My problem is that I have been unsuccessful in getting it to work with SSL requests using Apache.

I know that Haproxy can not handle SSL requests so I am trying to set up Apache to accept the clients requests on port 443 and forward it to Haproxy which will then pick up and forward the requests to the right Apache back end web server. Has anyone done this successfully? If yes can you provide examples of the Apache and Haproxy config please?

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

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

发布评论

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

评论(2

能怎样 2024-07-22 03:57:49

是的,我有,请在此处查看配置链接文本

Yes I have please see the configuration here link text

幸福还没到 2024-07-22 03:57:49

我使用nginx,这里是一个示例nginx.conf:

server {
    listen       443;
    server_name  localhost;

    ssl                  on;
    ssl_certificate      /etc/pki/tls/certs/localhost.crt;
    ssl_certificate_key  /etc/pki/tls/private/localhost.key;

    ssl_session_timeout  5m;

    ssl_protocols  SSLv2 SSLv3 TLSv1;
    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers   on;

    location / {
        root   html;
        index  index.html index.htm;

            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_max_temp_file_size 0;

            proxy_pass http://127.0.0.1:8000;
            break;
    }
}

在haproxy.cfg中,设置:

listen http_proxy 127.0.0.1:8000

I use nginx, here is an example nginx.conf:

server {
    listen       443;
    server_name  localhost;

    ssl                  on;
    ssl_certificate      /etc/pki/tls/certs/localhost.crt;
    ssl_certificate_key  /etc/pki/tls/private/localhost.key;

    ssl_session_timeout  5m;

    ssl_protocols  SSLv2 SSLv3 TLSv1;
    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers   on;

    location / {
        root   html;
        index  index.html index.htm;

            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_max_temp_file_size 0;

            proxy_pass http://127.0.0.1:8000;
            break;
    }
}

In haproxy.cfg, set:

listen http_proxy 127.0.0.1:8000

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