add_header Content-Type text/plain; //文件内容以文本格式显示//例如 location = /md/test.txt { //匹配到这里,显示文件内容,而不是下载 root /home/wwwroot/default; add_header Content-Type text/plain; }