gpt4 book ai didi

ssl - 无法验证第一个证书代理 nginx

转载 作者:太空宇宙 更新时间:2023-11-03 14:33:50 25 4
gpt4 key购买 nike

我正在配置 nginx,同时使用前端和后端相同的域,例如

my-domain.com -> frontend

my-domain.com/api/ -> backend.

当运行 HTTP 时它运行正常,但我配置 https,它没有运行第一个请求。我不知道出了什么问题。

前端我用的是NextJs,SSR框架

I'm using isomorphic-unfetch request.

请帮助我,谢谢。

upstream customer-ssr {
server 127.0.0.1:3030;
keepalive 64;
}

server {
listen 80;
server_name my-domain.com www.my-domain.com;
return 301 https://my-domain.com$request_uri;
}

server {
listen 443 ssl http2;
server_name www.my-domain.com;
return 301 $scheme://my-domain.com$request_uri;
}

server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;

server_name my-domain.com;

root /home/my-domain/my-domain-web/current;

ssl_certificate /etc/nginx/ssl/my-domain.com.crt;
ssl_certificate_key /etc/nginx/ssl/my-domain.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_max_temp_file_size 0;
proxy_pass http://customer-ssr;
proxy_redirect off;
proxy_read_timeout 240s;
}

location /api/ {
proxy_buffering off;
proxy_set_header Host $proxy_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://110.95.104.901:8888;
}
}

最佳答案

在你的 main(index/server).js 文件中写下这一行:

/**
* Handle UNABLE_TO_VERIFY_LEAF_SIGNATURE error
**/
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

关于ssl - 无法验证第一个证书代理 nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49974979/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com