docx, xlsx, pptx가 웹 서버에서 zip 파일로 다운로드되는 이유는 무엇입니까?

docx, xlsx, pptx가 웹 서버에서 zip 파일로 다운로드되는 이유는 무엇입니까?

내 Apache 서버에는 여러 docx, xlsx pptx 파일이 저장되어 있습니다.

일부 클라이언트 브라우저는 이러한 파일을 일반 zip 파일로 간주하여 다운로드할 때 파일 확장자를 변경합니다. 더 이상 그렇게 하지 않게 하려면 어떻게 해야 합니까?

(우분투 서버 사용)

답변1

파일은 실제로 XML 문서의 ZIP입니다. Apache의 .htaccess에 이것을 추가하십시오.

AddType application/vnd.ms-word.document.macroEnabled.12 docm
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam
AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
AddType application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application/vnd.ms-excel.template.macroEnabled.12 xltm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx

답변2

서버에 새 ms 파일 형식에 대해 적절한 MIME 형식이 설정되어 있지 않습니다.

/etc/mime.types 파일에 다음을 추가하고 Apache를 다시 시작하면 문제가 해결됩니다.

# Added by myname 2009-06-03
application/vnd.ms-word.document.macroEnabled.12                        docm
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
application/vnd.ms-powerpoint.template.macroEnabled.12                  potm
application/vnd.openxmlformats-officedocument.presentationml.template   potx
application/vnd.ms-powerpoint.addin.macroEnabled.12                     ppam
application/vnd.ms-powerpoint.slideshow.macroEnabled.12                 ppsm    
application/vnd.openxmlformats-officedocument.presentationml.slideshow  ppsx
application/vnd.ms-powerpoint.presentation.macroEnabled.12              pptm
application/vnd.openxmlformats-officedocument.presentationml.presentation       pptx
application/vnd.ms-excel.addin.macroEnabled.12                          xlam
application/vnd.ms-excel.sheet.binary.macroEnabled.12                   xlsb
application/vnd.ms-excel.sheet.macroEnabled.12                          xlsm
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet       xlsx    
application/vnd.ms-excel.template.macroEnabled.12                       xltm    
application/vnd.openxmlformats-officedocument.spreadsheetml.template    xltx

http://www.webdeveloper.com/forum/showthread.php?t=162526이 문제에 대한 정보가 있습니다

답변3

귀하의 웹 서버가 이러한 파일 내의 마법의 숫자를 보고 그것이 zip 파일임을 확인하는 것 같습니다.

다음을 살펴보세요:http://www.webdeveloper.com/forum/showthread.php?t=162526

답변4

다운로드http://packages.ubuntu.com/oneiric/mime-support, dpkg -i를 사용하여 설치합니다. 훌륭하게 일했어요!

추신: Ubuntu 및 Debian의 Apache는 /etc/mime.types에서 읽습니다.

관련 정보