如何更改 MAMP 中的 mime 类型

发布于 2024-09-09 05:05:47 字数 312 浏览 8 评论 0原文

我正在开发一个包含 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

等待我真够勒 2024-09-16 05:05:47

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.

音盲 2024-09-16 05:05:47

您是否安装并启用了 mod_mime_magic?你的哑剧魔法正常吗?当您对 OGG 文件之一执行 file -m 时,它是否表示它是纯文本文件?文件扩展名是否正确?

Do you have mod_mime_magic installed and enabled? Is your mime magic working correctly? When you do file -m on one of your OGG files, does it say it is a plain text file? Are the file extensions correct?

慈悲佛祖 2024-09-16 05:05:47

添加 mime-type 对于所有人来说都是相同的,只是您需要了解类型将如何应用以及 mime-type 点是什么。在这个答案中,我将如何尝试在 MAMP 中添加 WebAssembly mime-type application/wasm

事情是这样的:

我最近尝试了 MAMP 中的 WebAssembly 并配置了以下适合我的 mime 类型。

首先,我们需要导航到MacOS的Applications/MAMP/conf/apache中的MAMP文件夹,然后打开文件mime.types任何编辑器。

打开文件后,在 mime.types 文件中的任意位置添加以下行:

application/wasm wasm

以下是我的 mime.types 文件中的 wasm mime 类型示例:

#application/wasm
application/wasm wasm

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's Applications/MAMP/conf/apache, And then open the file mime.types in any editor.

After opening the file, add the following line anywhere in the mime.types file:

application/wasm wasm

Here is the example wasm mime type in my mime.types file:

#application/wasm
application/wasm wasm
几度春秋 2024-09-16 05:05:47

如今,在 MAMP Pro 中,您可以使用 gui 添加 参数。下面的屏幕截图显示了我如何为 .mjs 和 .wasm 添加 MIME 类型,如下所示:

AddType application/javascript      .mjs
AddType application/wasm      wasm

屏幕截图

添加后不要忘记重新启动服务器。

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:

AddType application/javascript      .mjs
AddType application/wasm      wasm

screenshot

Don't forget to restart the server after adding.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文