阿帕奇无法正常供应.mp4文件 - 显示文件的内容,而不是下载提示 [英] Apache not serving .mp4 files correctly - shows the contents of the file rather than a download prompt

查看:221
本文介绍了阿帕奇无法正常供应.mp4文件 - 显示文件的内容,而不是下载提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux上运行的Apache,当我去到一个URL,它是一个.MP4文件,而不是让我下载的文件则显示文件的内容(如文字错位)

I am running Apache on Linux, and when I go to a url that is a .mp4 file rather than let me download the file it shows the contents of the file (as mangled text)

如放出来是

ftypisom isomiso2avc1mp41 *moov lmvhd ̴ d̴ d @ Htrak \\tkhd ̴ d̴ d @ $edts elst mdia mdhd̴d̴d
-hdlr vide VideoHandler kminf vmhd

��� ftypisom���isomiso2avc1mp41��*moov���lmvhd����̴�d̴�d��������������������������������������������������@��������������������������������Htrak���\tkhd���̴�d̴�d��������������������������������������������������������@������������$edts���elst��������������������mdia��� mdhd����̴�d̴�d���� ��������-hdlr��������vide������������VideoHandler���kminf���vmhd��������������

我如何让Apache正确投放呢?

How do I make Apache serve it correctly?

推荐答案

添加将AddType 指令:

AddType video/mp4 .mp4

这也可以让Apache正确的头发送到您的浏览器,然后将选择正确的方法下载或播放媒体文件。

This will cause Apache to send the correct headers to your browser, which will then select the correct method to download or play the media file.

请确保您有 mod_mime 安装并激活了(不过,我想这是在默认情况下,我从未有过的任何问题与此)。

Make sure you have mod_mime installed and activated (but I reckon it is by default; I never had any issues with this).

更多信息: http://httpd.apache.org/docs/ 2.2 / MOD / mod_mime.html

这篇关于阿帕奇无法正常供应.mp4文件 - 显示文件的内容,而不是下载提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆