问题原文
原帖链接 · tobib · CC BY-SA 4.0
I want to serve a markdown version of my blog. Imagine http://myblog.com/some/post/ and two requests:
Accept: text/html->http://myblog.com/some/post/index.htmlAccept: text/markdown->http://myblog.com/some/post/index.md
How do I configure nginx to do this?
I read the documentation on index but it didn't mention content negotiation at all.
已采纳解答
原帖链接 · Richard Smith · CC BY-SA 4.0
If you just need to use content negotiation with your index files, you could use the index directive with a variable defined using a map. See this document for details.
For example:
map $http_accept $myindex {
default index.html;
~*text/markdown index.md;
}
index $myindex index.html;
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
