Nginx和后端服务器之间的2种SSL

维德什

我在Node.js上有一个后端服务器,并且试图在Nginx和此后端服务器之间设置2种方式的SSL。

但我得到一个错误: 2015/11/02 06:51:02 [error] 12840#12840: *266 upstream SSL certificate does not match "myLocalMachine" while SSL handshaking to upstream,

这是我定下的时候proxy_ssl_verify on如果它off那么它工作正常。以下是我的Nginx设置:

upstream myLocalMachine {
    server MyPublicIP:8888;
}

server {
    listen 8222 ssl;
    proxy_cache two;
    ssl_certificate /etc/nginx/ssl/server-cert.pem;
    ssl_certificate_key /etc/nginx/ssl/server-key.pem;
    ssl_client_certificate /etc/nginx/ssl/client-cert.pem;
    ssl_verify_client on;
    location / {
            proxy_ssl_session_reuse off;
            proxy_ssl_verify on;
            proxy_ssl_trusted_certificate /etc/nginx/ssl/backend-server-cert.pem;
            proxy_ssl_certificate /etc/nginx/ssl/server-cert.pem;
            proxy_ssl_certificate_key /etc/nginx/ssl/server-key.pem;
            proxy_ssl_password_file /etc/nginx/ssl/pwd.pass;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $host;
            proxy_pass https://myLocalMachine;
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_cache_valid any   1m;
            proxy_cache_min_uses 1;
            #proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment;
            proxy_cache_methods GET HEAD POST;
            proxy_cache_key "$request_body";
    }
}
维德什

解决方案:

我曾在证书中使用过url,可以这样说:example.com但是我myLocalMachine在上游和proxy_pass中使用了一些自定义名称,我用url替换了它。

在上游区块和proxy_pass中使用网址,如下所示

upstream example.com {
    # ip & ports are for examples
    server 11.11.11.11:2222;
}

proxy_pass https://example.com;

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

使用 SSL 和前端 + 后端相同服务器的 Nginx

React前端服务器和PHP / Symfony后端服务器之间的共享会话

同步apache服务器和nginx之间的php会话

Nginx提供静态文件并代理到后端服务器

Nginx多后端一台服务器

Nginx和Apache2(代理服务器)

yii2前端和后端在共享服务器上不起作用

Angular 2本地主机和后端服务器连接

2种方式的SSL-客户端证书未发送到服务器

如何使用 Nginx 在同一服务器但不同路径上部署后端和前端

在 GUACD 和 Guacamole Web 服务器 (Tomcat) 之间启用 SSL

无法使用SSL在Java客户端和python服务器之间执行通信

MPMoviePlayerController和基于身份的HLS后端服务器

Tomcat-两种SSL作为服务器

与后端服务器连接

nginx中的uwsgi模块和uwsgi服务器之间的区别

带有 nginx 的 Droplet 和谷歌云存储之间的状态 500 内部服务器错误

如何从iOS应用连接到后端服务器?如何读取,修改和获取数据到后端服务器?

如何让 OpenJDK 16 与启用 SSL 的 nginx 服务器通信?

无法使用 nginx 在快速服务器上配置 SSL

Websocket,服务器发送事件(SSE)和HTTP2的服务器推送之间有什么区别?

我可以在原始服务器和cloudflare服务器之间使用HTTP / 2吗(Apache)

是否可以让上游服务器在 Nginx 服务器后面处理 SSL 证书?

始终选择Nginx默认服务器-多个SSL服务器

配置 Vue.js 以允许浏览器刷新(django 后端、nginx 服务器)

服务器和客户端之间以两种方式进行进程间通信的最佳方式

我可以在一台服务器上托管Angular2前端和Golang后端吗

配置Apache以将SSL客户端证书发送到后端服务器

为Django网站记录在线用户的快照(PostgreSQL后端,nginx Web服务器)