Nginx 配置apple-app-site-association


ios突然給我發了如上鏈接和一個json,說他那邊需要放一個 apple-app-site-association 文件用來支持他那邊的功能,文件不需要后綴。
先說一下要求:線上官網的地址后面跟上他所需要文件的地址,比如 www.baidu.com/.well-known/apple-app-site-association,可以下載該文件。

添加配置文件到/.well-known 目錄,用於h5頁面喚起APP時,Apple向服務器獲取到該配置文件作后續操作

開始配置:
首先打開服務器nginx的配置文件,在站點的配置下加一個 location 入口

location /.well-known/apple-app-site-association {
charset UTF-8;
default_type application/octet-stream;
return 200 '{"applinks":{"apps":[],"details":[{"appID":"xxxxxxxxxxxxxxxxx","paths":["/*"]}]}}';
}

訪問官網鏈接 www.baidu.com/.well-knowna/pple-app-site-association 即可直接下載

如果想要打開頁面展示里面的文本信息 需要更改default_type text/html;會將這個視為html文件直接打開。
https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW1


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM