Apache配置SSL(MAC),实现IPA自动安装
1、制作签名证书
1.1、生成私钥,命令: sudo openssl genrsa -des3 -out app.key 1024
1.2、生成签署申请,命令: sudo openssl req -new -key app.key -out app.csr
1.3、生成服务器的私钥,命令: sudo openssl rsa -in app.key -out server.key
1.4、-生成给网站服务器签署的证书,命令: sudo openssl req -new -x509 -days 3650 -key server.key -out server.crt
操作步骤中的Common Name请填写自己的服务器地址或者ip
2、配置Apache文件,开启ssl
2.1、解开一下几行注释掉的代码(/etc/apache2/httpd.conf)
LoadModule ssl_module libexec/apache2/mod_ssl.so /*(加载ssl模块)*/
Include /etc/apache2/extra/httpd-ssl.conf /*加载ssl配置文件*/
Include /etc/apache2/extra/httpd-vhosts.conf /*加载定向文件*/
2.2、修改以下文件(/etc/apache2/extra/httpd-ssl.conf)
SSLCertificateFile "/etc/apache2/ssl/server.crt" /*加载证书*/
SSLCertificateKeyFile "/etc/apache2/ssl/server.key" /*加载密钥*/
2.3、修改以下文件(/etc/apache2/extra/httpd-vhosts.conf)
<VirtualHost *:443> SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile /etc/apache2/server.crt SSLCertificateKeyFile /etc/apache2/server.key ServerName 10.191.38.169 DocumentRoot "/Library/WebServer/Documents" </VirtualHost> 如果出现80端口不能访问,修改此文件以下代码 <VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "/Library/WebServer/Documents" ServerName dummy-host.example.com ServerAlias www.dummy-host.example.com ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log" CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common </VirtualHost>
2.4、运行命令:sudo apachectl configtest 检查配置是否正确
2.5、重启apache: sudo apachectl restart
3、配置IPA下载HTML
3.1、代码如下
1 <html> 2 <head> 3 <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 4 <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 5 <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> 6 <META HTTP-EQUIV="Expires" CONTENT="0"> 7 </head> 8 <body> 9 <center> 10 <h1>微信扫码后,选择屏幕右上角(在safari打开)</h1> 11 12 <a href="https://10.191.38.169/server.crt"><font style='color:#ff00ff;font-size:40px'>点我吧,第一次得安装证书</h1></a> 13 <a href="itms-services://?action=download-manifest&url=https://10.191.38.169/test180.plist"><font style='color:#ff0000;font-size:40px'>点此安装180测试包</h1></a> 14 </center> 15 16 </body> 17 </html>
4、配置Plist文件
4.1、代码如下
<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://10.191.38.169/test180.ipa</string> </dict> <dict> <key>kind</key> <string>display-image</string> <key>needs-shine</key> <true/> <key>url</key> <string>https://10.191.38.169/57.png</string> </dict> <dict> <key>kind</key> <string>full-size-image</string> <key>needs-shine</key> <true/> <key>url</key> <string>https://10.191.38.169/512.png</string> </dict> </array> <key>metadata</key> <dict> <key>bundle-identifier</key> <string>com.open.tongxue</string> <key>bundle-version</key> <string>2.4.0</string> <key>kind</key> <string>software</string> <key>title</key> <string>同学+</string> </dict> </dict> </array> </dict> </plist>