自己服务器上部署APP应用(安卓和IOS版),下载页面的代码,以及IOS的xxx.plist文件的建立
生活随笔
收集整理的這篇文章主要介紹了
自己服务器上部署APP应用(安卓和IOS版),下载页面的代码,以及IOS的xxx.plist文件的建立
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
第一 先安裝nginx
第二 修改nginx配置
# vim /usr/local/nginx/conf/nginx.conf#配置用戶和用戶組 #user nobody; #工作進程數,建議設置為CPU的總核數 worker_processes 4; #全局錯誤日志定義類型,日志等級從低到高依次為: debug | info | notice | warn | error | crit #error_log logs/error.log; #error_log logs/error.log notice; error_log logs/error.log info; #記錄主進程ID的文件 #pid logs/nginx.pid; #工作模式與連接數上限 events {#單個進程允許的最大連接數worker_connections 1024; } #設定http服務器,利用它的反向代理功能提供負載均衡支持 http {#文件擴展名與文件類型映射表include mime.types;#默認文件類型default_type application/octet-stream;#日志格式log_format main '$remote_addr - $remote_user [$time_local] "$request" '# '$status $body_bytes_sent "$http_referer" '# '"$http_user_agent" "$http_x_forwarded_for"';#access log 記錄了哪些用戶,哪些頁面以及用戶瀏覽器、ip和其他的訪問信息access_log logs/access.log main;#開啟文件傳輸,一般應用都應設置為on;若是有下載的應用,則可以設置成off來平衡網絡I/O和磁盤的I/O來降低系統負載sendfile on;#告訴nginx在一個數據包里發送所有頭文件,而不一個接一個的發送。#tcp_nopush on;#長連接超時時間,單位是秒#keepalive_timeout 0;keepalive_timeout 65;### gzip模塊設置,使用 gzip 壓縮可以降低網站帶寬消耗,同時提升訪問速度。gzip on; #開啟gzipgzip_min_length 1k; #最小壓縮大小gzip_buffers 4 16k; #壓縮緩沖區gzip_http_version 1.0; #壓縮版本gzip_comp_level 2; #壓縮等級gzip_types text/plain application/x-javascript text/css application/xml; #壓縮類型### gzip 模塊 end#一臺服務器掛了,自動去找另一臺服務器,這要使用到proxy_pass#注意:upstream中的server元素必須要注意,不能加http://,但proxy_pass中必須加#upstream toms{# server 47.92.163.127:8080;#} #server 配置 begin,可以配置多個# 包含所有的虛擬主機的配置文件# include conf/mhost/*;server_tokens off; limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; server{listen 80;server_name www.xxx.com;limit_req zone=one burst=5; #最多等待5個請求,多余的拒接access_log logs/indexaccess.log main;error_log logs/indexerror.log;if ($request_method !~ ^(GET|POST)$ ) {return 444;} location / {# proxy_pass http://toms;root /usr/local/html/dist/static/index/pc/;if ( $http_user_agent ~ "(MIDP)|(WAP)|(UP.Browser)|(Smartphone)|(Obigo)|(Mobile)|(AU.Browser)|(wxd.Mms)|(WxdB.Browser)|(CLDC)|(UP.Link)|(KM.Browser)|(UCWEB)|(SEMC-Browser)|(Mini)|(Symbian)|(Palm)|(Nokia)|(Panasonic)|(MOT-)|(SonyEricsson)|(NEC-)|(Alcatel)|(Ericsson)|(BENQ)|(BenQ)|(Amoisonic)|(Amoi-)|(Capitel)|(PHILIPS)|(SAMSUNG)|(Lenovo)|(Mitsu)|(Motorola)|(SHARP)|(WAPPER)|(LG-)|(LG/)|(EG900)|(CECT)|(Compal)|(kejian)|(Bird)|(BIRD)|(G900/V1.0)|(Arima)|(CTL)|(TDG)|(Daxian)|(DAXIAN)|(DBTEL)|(Eastcom)|(EASTCOM)|(PANTECH)|(Dopod)|(Haier)|(HAIER)|(KONKA)|(KEJIAN)|(LENOVO)|(Soutec)|(SOUTEC)|(SAGEM)|(SEC-)|(SED-)|(EMOL-)|(INNO55)|(ZTE)|(iPhone)|(Android)|(Windows CE)|(Wget)|(Java)|(curl)|(Opera)" ){root /usr/local/html/dist/static/index/mobile/;}index index.html index.htm;}}server{#admin靜態頁面listen 80;server_name admin.abc.xxx.com;access_log logs/frontaccess.log main;error_log logs/fronterror.log;location ~ \.(html|js|css|png|jpg|gif|woff|woff2|ttf|apk|ipa)$ {root /usr/local/html/dist/;index index.html index.htm;}location ^~ /api/{proxy_pass http://127.0.0.1:10001/;}}server {listen 80;server_name back.xxxxx.com;access_log logs/backaccess.log main;error_log logs/backerror.log;location / {proxy_http_version 1.1;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://127.0.0.1:10001;}}} # pwd /usr/local/html/dist [root@ycz dist]# ls caizhan99_android.apk favicon.ico xy729_???_Sh.ipa_1.1.1.ipa caizhan99_ios.ipa index.html cpw.plist #IOS安裝清單 static第三? 移動端的訪問首頁文件(index.html)
# pwd /usr/local/html/dist/static/index/mobile # vim index.html <!--* @Descripttion: * @version: * @Author: falost* @LastEditors: falost* @Date: 2019-06-01 10:42:11* @LastEditTime: 2019-06-01 11:48:15--> <!DOCTYPE html> <html lang="en"> <head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="renderer" content="webkit"><meta name="Author" content="觀極、Leien"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"><title>99keji下載</title><style>.bg_img {background: url("./bgImg.jpg") no-repeat center;background-size: contain;width: 100%;height: 100%;position: relative;}body,html{margin:0;padding:0;height:100%;}.download_btn{position: relative;left: 50%;top: 85%;width: 150px;text-align: center;padding: 10px 15px;transform: translate(-50%, -50%);border-radius: 5px;margin-top: 5px;color: #fff;background: -webkit-linear-gradient(left top,#dbdcde , #1f3300);}.beian{position: absolute;bottom:15px;left:50%;transform: translateX(-50%) translateY(-50%);color:#fff;font-size:12px;}</style> </head> <body><div class="bg_img"><div class="download_btn" onclick="toDownload()">點擊下載</div><div class="beian">陜ICP備190xxxx號-1</div></div> </body> <script> // toDownload();// 新的方法function toDownload(){console.log("ddd");console.log(IsPC());var u = navigator.userAgent;var ua = u.toLowerCase();if (/iphone|ipad|ipod/.test(ua)) { // iOS 系統 -> 跳AppStore下載地址//alert("iOS");window.location.href = 'itms-services://?action=download-manifest&url=https://www.falost.cc/public/cpw.plist'; //必須用https協議訪問cpw.plist安裝清單--->IOS簽名的 ,可以搭建一個ftp服務器放在下面,也可以在本服務器上放置.plist文件} else if ( /android/.test(ua)) { // 安卓系統 -> 跳安卓端下載地址console.log("ssss"); window.location.href = 'http://admin.abc.caizhan99.com/caizhan99_android.apk';//alert("android");} else if (IsPC()){ // PC端window.location.href = 'http://admin.abc.caizhan99.com/caizhan99_android.apk';}}function IsPC() {if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {return false;}else {return true;}}</script> </html>?
寫IOS 的安裝清單文件 cpw.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>http://admin.abc.caizhan99.com/caizhan99_ios.ipa</string></dict><dict><key>kind</key><string>full-size-image</string><key>needs-shine</key><true/><key>url</key><string>http://admin.abc.caizhan99.com/logo.png</string></dict><dict><key>kind</key><string>display-image</string><key>needs-shine</key><true/><key>url</key><string>http://admin.abc.caizhan99.com/logo.png</string></dict> </array><key>metadata</key><dict><key>bundle-identifier</key><string>com.app.cpw</string><key>bundle-version</key><string>1.1.0</string><key>kind</key><string>software</string><key>title</key><string>好貨</string></dict></dict></array> </dict> </plist>?
?下載安裝包放置路徑? ?:? ?http://admin.abc.caizhan99.com/caizhan99_ios.ipa
IOS 清單文件放置路徑:? ?https://www.xxx.cc/public/cpw.plis
?
第四? ?生成訪問二維碼:
?
第五? 訪問測試
1, 用微信打開 ,不要用 Safari瀏覽器打開:
2, 信任安裝:
完工:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
?
?
?
?
?
總結
以上是生活随笔為你收集整理的自己服务器上部署APP应用(安卓和IOS版),下载页面的代码,以及IOS的xxx.plist文件的建立的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 堡垒机的使用-及功能
- 下一篇: 互联网项目开始时需要去谈的产品需求分析: