Home >Backend Development >PHP Tutorial >The role of MIME types in nginx

The role of MIME types in nginx

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 09:01:531510browse

The relationship between MIME-type and Content-Type:
When the web server receives a static resource file request, it finds the corresponding MIME Type in the server's MIME configuration file based on the suffix name of the request file, and then sets the HTTP Response based on the MIME Type. Content-Type, and then the browser processes the file based on the value of Content-Type.
What is MIME-TYPE:
Why do you say that? First, we need to understand how browsers process content. The content displayed in the browser includes HTML, XML, GIF, and Flash...
So, how does the browser distinguish between them, and what form of content is displayed in what form? The answer is MIME Type, which is the media type of the resource.
The media type is usually informed to the browser by the web server through the HTTP protocol. More precisely, it is represented by Content-Type, for example:
Content-Type: text/HTML
Indicates that the content is of text/HTML type. That is, a hypertext file. Why "text/HTML" instead of "HTML/text" or something? MIME Type is not specified by individuals. It is negotiated by the IETF organization and published online as a recommended standard in the form of RFC. Most Web servers and user agents will support this specification (by the way, the type of Email attachments is also passed through MIME Type specified).
Usually only some formats that are widely used on the Internet will get a MIME Type. If it is a format defined by a client, it can generally only start with application/x-.
XHTML is a widely used format. Therefore, in RFC 3236, it is stated that the MIME Type of XHTML format files should be application/xHTML+XML.
Of course, when processing local files, if no one tells the browser the MIME Type of a file, the browser will also do some default processing. This may be related to the MIME Type you configured for the file in the operating system. For example, under Windows, open the "HKEY_LOCAL_MACHINESOFTWAREClassesMIMEDatabaseContent Type" primary key in the registry, and you can see the configuration information of all MIME Types.

The above has introduced the role of MIME types in nginx, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn