如何更改 MAMP 中的 mime 类型
我正在开发一个包含 HTML5 视频的网站。看起来 ogg 文件与 video/ogg firefox 翻转之外的其他 mime 类型一起提供。我已经更新了 mamp/apache/config 文件夹中的 mime.types 文件,并多次重新启动了 MAMP 服务器,但 ogg 文件仍然以纯/文本上下文类型提供。
有人可以指出我需要做什么吗?
更新
我唯一能够更改 mime 类型的情况是,将 DefaultType text/plain
更改为 DefaultType video/ogg
,这是愚蠢的。
I'm developing a website that has a HTML5 video. It looks like when ogg files are served with other mime types than video/ogg firefox flips. I've updated the mime.types file inside the mamp/apache/config folder and have restarted the MAMP server multiple times, but ogg files are still served with plain/text context-type.
Can someone point out what I need to do?
UPDATE
The only time I'm able to change the mime type is if I change the DefaultType text/plain
to DefaultType video/ogg
which is stupid.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
mime.types 文件位于Applications/MAMP/conf/apache 中,
您可以在那里更改您的mime 类型。
更改文件后重置服务器使其生效。
The mime.types file is in Applications/MAMP/conf/apache
There you can alter your mime types.
Reset server after changing the file for it to take effect.
您是否安装并启用了
mod_mime_magic
?你的哑剧魔法正常吗?当您对 OGG 文件之一执行file -m
时,它是否表示它是纯文本文件?文件扩展名是否正确?Do you have
mod_mime_magic
installed and enabled? Is your mime magic working correctly? When you dofile -m
on one of your OGG files, does it say it is a plain text file? Are the file extensions correct?添加 mime-type 对于所有人来说都是相同的,只是您需要了解类型将如何应用以及 mime-type 点是什么。在这个答案中,我将如何尝试在 MAMP 中添加 WebAssembly mime-type
application/wasm
。事情是这样的:
我最近尝试了 MAMP 中的 WebAssembly 并配置了以下适合我的 mime 类型。
首先,我们需要导航到MacOS的
Applications/MAMP/conf/apache
中的MAMP
文件夹,然后打开文件mime.types
任何编辑器。打开文件后,在
mime.types
文件中的任意位置添加以下行:以下是我的
mime.types
文件中的 wasm mime 类型示例:Adding mime-type is the same for all, it's just you need to understand how the types will be applied and what's the mime-type point is. In this answer I'll how I tried to add WebAssembly mime-type
application/wasm
in MAMP.Here it goes:
I recently tried WebAssembly in MAMP and configured out the below mime-type that works for me.
First, we need to navigate the folder of
MAMP
in MacOS'sApplications/MAMP/conf/apache
, And then open the filemime.types
in any editor.After opening the file, add the following line anywhere in the
mime.types
file:Here is the example wasm mime type in my
mime.types
file:如今,在 MAMP Pro 中,您可以使用 gui 添加
参数。下面的屏幕截图显示了我如何为 .mjs 和 .wasm 添加 MIME 类型,如下所示:屏幕截图
添加后不要忘记重新启动服务器。
In MAMP Pro these days you can add
<VirtualHost>
parameters using the gui. Here's a screenshot showing how I add MIME types for .mjs and .wasm as:screenshot
Don't forget to restart the server after adding.