大网数据广告活动
服务器运维问答

Using Nginx as a HTTPS reverse proxy

· 52CE 我爱测

I'm trying to setup an Nginx server to reverse proxy a tomcat web service (which I don't have access to). This is essentially because the Tomcat server is running TLSv1.0 so I'm trying to bump up the version. However, when I try …

问题原文

原帖链接 · Chris Edgington · CC BY-SA 3.0

I'm trying to setup an Nginx server to reverse proxy a tomcat web service (which I don't have access to). This is essentially because the Tomcat server is running TLSv1.0 so I'm trying to bump up the version.

However, when I try to access the proxy I'm getting a 502 error. The Ngnix logs are showing - SSL_do_handshake() failed (SSL: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol) while SSL handshaking to upstream.

Here's my Nginx configuration -

ssl_certificate  /etc/nginx/certs/public.pem;
ssl_certificate_key  /etc/nginx/certs/private.key;
ssl_session_timeout  5m;
ssl_prefer_server_ciphers  on;
ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers  AES256+EECDH:AES256+EDH:!aNULL;

server {
    listen 6003;
    server_name example.com;
    ssl on;
    location / {
        proxy_pass https://example.com:6003;
    }
}

I've tried the same thing with Apache but see exactly the same error. Does anyone have any ideas?

已采纳解答

原帖链接 · shonky linux user · CC BY-SA 3.0

This is a similar answer to nginx as reverse proxy with upstream SSL. There are separate ssl settings to set the acceptable protocols for your upstream proxy

...

server {

    listen 6003;
    server_name example.com;
    ssl on;
    ssl_certificate  /etc/nginx/certs/example.pem;
    ssl_certificate_key  /etc/nginx/certs/private.key;
    ... other settings

    location / {
        proxy_pass https://example.com:6003;
        proxy_ssl_trusted_certificate /etc/nginx/certs/example.pem;
        proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    }
}

The three listed values for proxy_ssl_protocols are the current default set but they could conceivably change in future releases to remove TLSv1 and TLSv1.1.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-02-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。