http://blog.csdn.net/zhaoxy_thu/article/details/21133399
今天升級了iOS7.1後發現通過之前的url無法安裝企業應用了,一直提示“無法安裝應用程序 因爲http://xxx.xxx.xxx證書無效”,折騰了一番,終於在StackOverFlow上找到了答案。在這裏分享給大家。
StackOverFlow鏈接:http://stackoverflow.com/questions/20276907/enterprise-app-deployment-doesnt-work-on-ios-7-1/22325916#22325916
原因是由於iOS7.1要安裝企業應用,url必須是https的,不能是http,這就要求我們的服務器要支持https。因此,只要將原鏈接:
- itms-services://?action=download-manifest&url=http://example.com/manifest.plist
改爲
- itms-services://?action=download-manifest&url=https://example.com/manifest.plist
即可。
對於服務器,則需要增加對https的支持,本人用的是apache服務器,所以在這裏以apache服務器爲例:
1. 安裝配有SSL模塊的apache版本,本人使用的是httpd-2.0.65-win32-x86-openssl-0.9.8y
2. 打開apache的配置文件conf/httpd.conf,去掉以下內容前的#
- LoadModule ssl_module modules/mod_ssl.so
並在文件最後加上:
- <VirtualHost *:8080>
- ServerAdmin [email protected](隨意)
- DocumentRoot D:/Server(服務器根目錄)
- ServerName 166.111.81.xxx(服務器域名或ip地址)
- ErrorLog logs/test-error_log
- CustomLog logs/test-access_log common
- SSLEngine on
- SSLCertificateFile "D:/Program Files/Apache Group/Apache2/conf/ssl.crt/server.crt"(之後生成證書的完整路徑)
- SSLCertificateKeyFile "D:/Program Files/Apache Group/Apache2/conf/ssl.key/server.key" (之後生成密鑰的完整路徑)
- </VirtualHost>
3. 修改conf/ssl.conf文件的以下內容:(以下爲修改完的,大家可以參考下)
- #SSLSessionCache none
- #SSLSessionCache shmht:logs/ssl_scache(512000)
- SSLSessionCache shmcb:logs/ssl_scache(512000)
- #SSLSessionCache dbm:logs/ssl_scache
- ...
- SSLCertificateFile conf/ssl.crt/server.crt
- ...
- SSLCertificateKeyFile conf/ssl.key/server.key
5. 在命令行下切換到apache目錄下的bin目錄,運行以下命令
生成服務器的私鑰:
- openssl genrsa -out server.key 1024
- openssl req -new –out server.csr -key server.key -config ..\conf\openssl.cnf
- openssl genrsa -out ca.key 1024
- openssl req -new -x509 -days 365 -key ca.key -out ca.crt -config ..\conf\openssl.cnf
9. 在當前目錄創建demoCA,裏面創建文件index.txt和serial,serial內容爲01,index.txt爲空,以及文件夾newcerts。
10. CA爲網站服務器簽署證書:- openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config ..\conf\openssl.cnf
- conf/ssl.crt/server.crt
- conf/ssl.key/server.key
13. 最後,我們要將自己創建的CA證書安裝到iphone上。將第10步生成的ca.crt文件通過郵件發送到iphone上,用自帶的Mail程序(別的程序不行)打開安裝即可。
14. 現在,再次訪問我們之前的itms-services鏈接,就可以正常安裝了。