Apache shows the contents of MP4 file rather than a download prompt

不羁的心 提交于 2019-12-29 09:21:52

问题


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)

eg the out put is

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

How do I make Apache serve it correctly?


回答1:


Add a AddType directive:

AddType video/mp4 .mp4

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.

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

More information here: http://httpd.apache.org/docs/2.2/mod/mod_mime.html



来源:https://stackoverflow.com/questions/13341453/apache-shows-the-contents-of-mp4-file-rather-than-a-download-prompt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!