gpt4 book ai didi

android - Unity3d Android 构建中的 "CertPathValidatorException: Trust anchor for certification path not found"

转载 作者:搜寻专家 更新时间:2023-11-01 07:50:48 28 4
gpt4 key购买 nike

我有来自 RapidSSL GeoTrust Inc. 的有效证书。但是当我尝试从 Android 设备向我的服务器发送请求时,出现错误:

javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

我在服务器上使用 nginx。如果我在浏览器中打开 url,它看起来没问题。如何让它适用于从 Unity3d 构建的 Android?

Nginx 配置:

server {
listen 443 ssl;
root /var/www/my_server.net;
server_name my_server.net;

index index.html index.php;

location / {
try_files $uri $uri/ /index.php$is_args$args;
}

location ~* \.(ico|jpg|jpeg|png|gif|swf|css|json|sd)$ {
try_files $uri =404;
access_log off;
expires 1m;
add_header Cache-Control "public";
}


ssl on;

ssl_certificate /var/cert.crt;
ssl_certificate_key /var/cert.key;

ssl_session_timeout 5m;

ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "RC4:HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;

error_page 404 /404.json;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

}

最佳答案

问题是因为我的 .crt 不包含中间证书。

This说明可以帮助您使用 RapidSSL 证书正确设置 nginx。

获得证书后,您应该制作中间 CA 和 SSL 证书的串联文件:

cat IntermediateCA.crt >> ssl_concatenated _certificate.crt

然后在 nginx 配置中使用这个连接的文件:

ssl_certificate /etc/ssl/ssl_concatenated _certificate.crt;

然后 this如果您的证书安装正确,您可以检查页面。你应该看到这样的东西:

enter image description here

此外,它还为您提供了保护服务器安全的提示。例如:

enter image description here

附言理查德·史密斯,感谢您的提示。

关于android - Unity3d Android 构建中的 "CertPathValidatorException: Trust anchor for certification path not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35418046/

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