Apache显示MP4文件的内容,而不是下载提示 [英] Apache shows the contents of MP4 file rather than a download prompt

查看:112
本文介绍了Apache显示MP4文件的内容,而不是下载提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux上运行Apache,当我转到一个.mp4文件的url而不是让我下载该文件时,它将显示文件的内容(以乱码显示)

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 tra \\tkhd ̴ d̴ d . mdia mdhd ̴ d̴ d -hdlr 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

这篇关于Apache显示MP4文件的内容,而不是下载提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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