Nginx无法打开mime.types文件,需要做哪些修改?

3

我使用以下内容运行Nginx:

sudo /usr/local/Cellar/nginx/1.2.8/bin/nginx -c /usr/local/Cellar/nginx/1.2.8/nginx.conf

它会抛出一个错误:

nginx: [emerg] open() "/usr/local/Cellar/nginx/1.2.8/mime.types" failed (2: No such file or directory) in /usr/local/Cellar/nginx/1.2.8/nginx.conf:17

这需要什么才能运作?
1个回答

3

你的 /usr/local/Cellar/nginx/1.2.8/ 下没有 mime.types 文件。

将你的 /usr/local/Cellar/nginx/1.2.8/nginx.conf 文件中第 17 行更改为正确的文件路径。

include /usr/local/Cellar/nginx/1.2.8/mime.types;

为了

include /usr/local/Cellar/nginx/1.2.8/conf/mime.types;

mime.types文件通常位于conf/目录中,如果没有找到,可以使用`locate mime.types'命令寻找。


谢谢您的回复。我已经大致了解了,只需使用-c选项让nginx运行指定的conf文件即可。 - uiwarrior
即使不使用Homebrew,此答案正确地确定了*.../conf目录中mime.types*文件的位置。非常顺利。 - s2t2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接