After the Tomcat installation is complete, the index.jsp file can be opened by default, but if you visit index.html a blank page is displayed, the reason is: in the $tomcat/conf/web.xml configuration file, what type of file is specified, which program is opened, But the default is not configured HTML or HTM, so we have to manually add on, and so on, Doc, war, PPT, etc. are the same method.
[Email protected] ~]vim $tomcat/conf/web.xml
........................................................
<mime-mapping>
<extension>htm</extension>
<mime-type>text/html;charset=gb2312</mime-type>
</mime-mapping>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html;charset=gb2312</mime-type>
</mime-mapping>
........................................................
This code can be added to any location, after a reboot, to take effect:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/76/E4/wKiom1ZehtGwu-AuAAB_OaZiBsk645.png "title=" 1.png " alt= "Wkiom1zehtgwu-auaab_oazibsk645.png"/>
Common Types of files:
<mime-mapping> <extension>doc</extension> <mime-type>application/vnd.ms-word</mime-type> </ mime-mapping> <mime-mapping> <extension>gif</ extension> <mime-type>image/gif</mime-type> </ mime-mapping> <mime-mapping> <extension>htm</ extension> <mime-type>text/html</mime-type> </ mime-mapping> <mime-mapping> <extension>html</ extension> <mime-type>text/html</mime-type> </ mime-mapping> <mime-mapping> <extension>jnlp</ Extension> <mime-type>application/x-java-jnlp-file</mime-type> </ mime-mapping> <mime-mapping> <extension>jpeg</ extension> <mime-type>image/jpeg</mime-type> < /mime-mapping> <mime-mapping> <extension>jpg</ extension> <mime-type>image/jpeg</mime-type> < /mime-mapping> <mime-mapping> <extension>js</ Extension> <mime-type>application/x-javascript</mime-type> </mime-mapping> <mime-mapping> < extension>pdf</extension> <mime-type>application/pdf</ mime-type> </mime-mapping> <mime-mapping> <extension>png</ extension> <mime-type>image/png</mime-type> </ mime-mapping> <mime-mapping> <extension>rar</ Extension> <mime-type>application/x-rar-compressed</mime-type > </mime-mapping> <mime-mapping> < extension>txt</extension> <mime-type>text/plain</ mime-type> </mime-mapping> <mime-mapping> <extension>xls</extension> <mime-type>application/ vnd.ms-excel</mime-type> </mime-mapping> <mime-mapping> <Extension>xml</extension> <mime-type>text/xml</mime-type > </mime-mapping> <mime-mapping> < extension>xul</extension> <mime-type>application/ vnd.mozilla.xul-xml</mime-type> </mime-mapping> <mime-mapping> <extension>zhtml</extension> < Mime-type>text/html</mime-type> </mime-mapping> <mime-mapping> <extension>zip</extension> <mime-type>application/x-zip</mime-type> </mime-mapping> < mime-mapping> <extension>zul</extension> <mime-type>text/hTml</mime-type> </mime-mapping>
Other common MIME types:
Hypertext Markup Language text. htm,.html text/html
Plain text. txt Text/plain
RTF text. rtf Application/rtf
GIF graphics. gif image/gif
JPEG graphics. Ipeg,.jpg Image/jpeg
Au sound file. Au audio/basic
Midi Music files Mid,.midi Audio/midi,audio/x-midi
RealAudio music files. RA,. Ram Audio/x-pn-realaudio
MPEG files. Mpg,.mpeg video/mpeg
AVI file. avi Video/x-msvideo
gzip file. GZ application/x-gzip
Tar file. Tar application/x-
This article is from the "Rookie Growth Road" blog, please be sure to keep this source http://francis905.blog.51cto.com/3048056/1718824
Tomcat configuration <mime-mapping> Implementation Auto-match file type HTML, etc.