前言
nginx展示文本文件内容,如果是不是常见的后缀名,就会提示直接下载,而不是直接展示内容。需要经过配置才能展示。
方法一
修改mime.types,添加plist扩展名为text/plain类型,直接显示文本。
在文件中添加如下内容
text/plainplist;
修改好mime.types类型后,reload一下nginx服务就可以生效,这样子修改是针对网站上的所有plist文件都生效
方法二
单独打开某个网站的配置文件,在server中修改,例如我让某个网站play目录下的plist文件显示为text/plain格式。
location ~ .*/play/.*\.plist$ {
add_header Content-Type text/plain;
}
# 让某个目录下的文件都显示为text/plain格式。
location /list/ {
location ~* {
add_header Content-Type text/plain;
}
}
reload一下nginx服务就可以生效
特别声明:以上内容(如有图片或视频亦包括在内)为自媒体平台“网易号”用户上传并发布,本平台仅提供信息存储服务。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.