0
0
Nginxdevops~5 mins

MIME types configuration in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a MIME type in the context of web servers like nginx?
A MIME type tells the browser what kind of file it is receiving, such as text, image, or video, so the browser knows how to handle or display it.
Click to reveal answer
beginner
Where does nginx typically store MIME type configurations?
In the file usually named mime.types, which is included in the main nginx configuration file.
Click to reveal answer
beginner
How do you include MIME types in the nginx configuration?
By using the directive include mime.types; inside the http block of the nginx config file.
Click to reveal answer
intermediate
What is the purpose of the default_type directive in nginx?
It sets the MIME type to use when a file's type is not found in the MIME types list, often set to application/octet-stream.
Click to reveal answer
intermediate
How would you add a custom MIME type for files with extension .abc in nginx?
Add a line like application/x-abc abc; inside the types block in the mime.types file or directly in the nginx config.
Click to reveal answer
What does the MIME type text/html tell the browser?
AThe file is a web page and should be displayed as HTML
BThe file is an image
CThe file is a video
DThe file is a compressed archive
Where do you include the MIME types file in nginx configuration?
AInside the <code>location</code> block
BInside the <code>server</code> block
CInside the <code>http</code> block
DAt the end of the config file
What happens if nginx cannot find a MIME type for a file?
AIt refuses to serve the file
BIt uses the <code>default_type</code> setting
CIt guesses the type automatically
DIt serves the file as plain text
How do you define a new MIME type for extension .xyz?
AAdd <code>application/xyz xyz;</code> in the <code>types</code> block
BRename the file to <code>.txt</code>
CChange the file content to HTML
DRestart nginx without changes
What file extension is commonly associated with the MIME type image/png?
A.jpg
B.svg
C.gif
D.png
Explain how nginx uses MIME types to serve files correctly to browsers.
Think about how nginx tells the browser what kind of file it is sending.
You got /4 concepts.
    Describe the steps to add a custom MIME type for a new file extension in nginx.
    Focus on where and how to add the new MIME type mapping.
    You got /4 concepts.