【问题标题】:Nginx could not open mime.types . What changes are required?Nginx 无法打开 mime.types 。需要进行哪些更改?
【发布时间】:2013-04-17 01:50:00
【问题描述】:

我使用以下来运行 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

这需要什么?

【问题讨论】:

    标签: types nginx mime


    【解决方案1】:

    /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' 命令找到它。

    【讨论】:

    • 感谢您的回复。我有点想通了,只是要求 nginx 使用 -c 运行指定的 conf 文件
    • 即使不使用自制软件,此答案也能正确识别 .../conf 目录中 mime.types 文件的位置。像魅力一样工作。
    猜你喜欢
    • 1970-01-01
    • 2017-05-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-15
    相关资源
    最近更新 更多