配置 nginx 以提供 manifest.json [英] Configure nginx to serve manifest.json
问题描述
应该如何配置 nginx
以便从我的应用程序的根文件夹提供 manifest.json
?
How should nginx
be configured in order to serve a manifest.json
from the root folder of my app?
我在 mime.types
中添加了一个条目:
I have added an entry in mime.types
:
application/x-web-app-manifest+json webapp;
并且由于我使用 json,因此我在启用站点的配置中添加了一个位置条目:
and since I use json I have added a location entry in my sites-enabled configuration:
location /manifest.json {
default_type application/x-web-app-manifest+json;
}
但是我的 manifest.json
仍然没有正确提供.
but my manifest.json
is still not served correctly.
知道我遗漏了什么或我应该以不同的方式配置什么吗?
any idea what did I miss or what should I configure differently?
推荐答案
其实我上面的配置是正确的,我的问题是我手机上的缓存 ;)
Well actually my configuration above is correct, my problem was the cache on my phone ;)
因为在我的 nginx 中进行更正之前我已经访问了我的 PWA,所以我的 manifest.json
被缓存了一个错误的内容
Since I already had accessed my PWA before making the corrections in my nginx, my manifest.json
was cached with a bad content
清除 Android 手机上的 Google Chrome 缓存并重试,当然在应用我的配置并重新启动后 nginx
解决了我的问题
Clearing the Google Chrome cache on my Android phone and trying again, of course after having applied my configuration and restarted nginx
solve my issue
这篇关于配置 nginx 以提供 manifest.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!