APNS SSL://gateway.sandbox.push.apple.com:2195连接失败 [英] APNS ssl://gateway.sandbox.push.apple.com:2195 connection fails
问题描述
我试图做一个推通知服务器。
我得到连接到SSL://gateway.sandbox.push.apple.com:通过telnet 2195
i try to make a push-notification server. I get connection to ssl://gateway.sandbox.push.apple.com:2195 with telnet.
telnet gateway.sandbox.push.apple.com 2195
Trying 17.172.232.229...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.
我*质子交换膜是确定(我用它另一台服务器上)。
我用的是同一个项目的其他服务器上,并可以正常访问,但在其他的服务器上克隆没有。
my *.pem is ok (I use it on another server). I use the SAME project on an other Server and it works there but the clone on an other Server doesn't.
我得到这些错误:
Warning: stream_socket_client() [function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages: error:14094415:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate expired in /var/www/try.php on line 69
Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /var/www/try.php on line 69
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /var/www/try.php on line 69
该证书没有过期,它的工作原理其他服务器上的日期是相同的。
The certificate is NOT expired, it works on the other Server and the date is the same.
是否有人有线索的错误可能是什么?
Does someone has a clue what the mistake could be?
,我的工作
Apache/2.2.9 (Debian) PHP/5.2.17-0.dotdeb.0 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g
编辑:
看来,在使用不同的服务器上使用相同的证书不起作用。也许这是由苹果服务器阻塞。
It seems, that using the same certificate on different servers doesn't work. Maybe this is blocked by Apples servers.
推荐答案
我使用 apn_on_rails 这一点,但我认为它会为你工作,只要你使用的是 PEM文件
。我通过重新下载证书和中级证书,再生的推送通知解决了这个 PEM
文件中使用这些指令:
I use apn_on_rails for this, but I think it will work for you as long as you are using a pem file
. I fixed this by re-downloading the certificate and intermediate certificate, regenerating the push notification pem
file using these instructions:
一旦你从苹果证书的申请,导出密钥
和苹果证书作为P12文件。这里是如何做到这一点走马观花:
Once you have the certificate from Apple for your application, export your key and the apple certificate as p12 files. Here is a quick walkthrough on how to do this:
1. Click the disclosure arrow next to your certificate in Keychain Access and select the certificate and the key.
2. Right click and choose `Export 2 items…`.
3. Choose the p12 format from the drop down and name it `cert.p12`.
Now covert the p12 file to a pem file:
$ openssl pkcs12 -in cert.p12 -out apple_push_notification_production.pem -nodes -clcerts
这篇关于APNS SSL://gateway.sandbox.push.apple.com:2195连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!