iOS在线安装环境搭建

搭建环境如下:
tomcat 8.0.29
jdk 1.8.66
OS Centos 7.1

  首先申请一个SSL证书(com.jks),假设证书的密码为:Aa01234567,放到tomcat的conf目录下,在tomcat的conf目录下的service.xml文件中找到如下代码:
<!-- <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> -->

修改成:

<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" maxHttpHeaderSize="8192" minSpareThreads="25" enableLookups="false" disableUploadTimeout="true" acceptCount="100" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" keystoreFile="/opt/tomcat/conf/com.jks" keystorePass="Aa01234567" clientAuth="false" sslProtocol="TLS" />
   在conf下的web.xml文件中的mime-mapping最后面加上如下几行代码:
    <mime-mapping>
        <extension>ipa</extension>
        <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>plist</extension>
        <mime-type>text/xml</mime-type>
    </mime-mapping>
   在webapps目录下面新建一个app文件夹,在该文件夹中新建一个html页面即app.html
   其内容如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
</head>  
<body>  
    <div align='center'>  
        <a href="itms-services://?action=download-manifest&url=https://url/app/oaapp.plist"><H1>在线安装</H1></a>  
    <div>  
</body>  
</html> 

再新建一个oaapp.plist文件,内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>items</key>
        <array>
                <dict>
                        <key>assets</key>
                        <array>
                                <dict>
                                        <key>kind</key>
                                        <string>software-package</string>
                                        <key>url</key>
                                        <string>https://url/app/oaapp.ipa</string>
                                </dict>
                                <dict>
                                        <key>kind</key>
                                        <string>display-image</string>
                                        <key>url</key>
                                        <string>https://url/app/oaapp.png</string>
                                </dict>
                        </array>
                        <key>metadata</key>
                        <dict>
                                <key>bundle-identifier</key>
                                <string>com.enterprise.service</string>
                                <key>kind</key>
                                <string>software</string>
                                <key>title</key>
                                <string>移动办公</string>
                        </dict>
                </dict>
        </array>
</dict>
</plist>

将相关的文件放到这个目录,启动tomcat目录即可。这样通过iphone访问点击在线安装,就可以在线安装app了。

参考了网络上的一些文章如下:
http://blog.csdn.net/bihailantian1988/article/details/12973507
http://stephen830.iteye.com/blog/2083643
http://blog.csdn.net/totogogo/article/details/7391531

你可能感兴趣的:(iOS在线安装环境搭建)