Move MIME-type and charset declaration into their own conf files

This commit is contained in:
Léo Colombaro 2019-02-10 20:40:50 +01:00
parent 452b630330
commit 2d135053cb
No known key found for this signature in database
GPG Key ID: 687B480A6D4F735F
3 changed files with 53 additions and 22 deletions

View File

@ -0,0 +1,32 @@
# ----------------------------------------------------------------------
# | Character encodings |
# ----------------------------------------------------------------------
# Serve all resources labeled as `text/html` or `text/plain`
# with the media type `charset` parameter set to `UTF-8`.
#
# https://nginx.org/en/docs/http/ngx_http_charset_module.html#charset
charset utf-8;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Update charset_types to match updated mime.types.
# text/html is always included by charset module.
# Default: text/html text/xml text/plain text/vnd.wap.wml application/javascript application/rss+xml
#
# https://nginx.org/en/docs/http/ngx_http_charset_module.html#charset_types
charset_types
text/css
text/plain
text/vnd.wap.wml
text/javascript
text/markdown
text/calendar
text/x-component
text/vcard
text/cache-manifest
text/vtt
application/json
application/manifest+json;

View File

@ -0,0 +1,18 @@
# ----------------------------------------------------------------------
# | Media types |
# ----------------------------------------------------------------------
# Serve resources with the proper media types (f.k.a. MIME types).
#
# https://www.iana.org/assignments/media-types/media-types.xhtml
# https://nginx.org/en/docs/http/ngx_http_core_module.html#types
include mime.types;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Default: text/plain
#
# https://nginx.org/en/docs/http/ngx_http_core_module.html#default_type
default_type application/octet-stream;

View File

@ -51,29 +51,10 @@ http {
include h5bp/security/server_software_information.conf; include h5bp/security/server_software_information.conf;
# Specify MIME types for files. # Specify MIME types for files.
# https://nginx.org/en/docs/http/ngx_http_core_module.html#types include h5bp/media_types/media_types.conf;
include mime.types;
# Default: text/plain # Set character encodings.
# https://nginx.org/en/docs/http/ngx_http_core_module.html#default_type include h5bp/media_types/character_encodings.conf;
default_type application/octet-stream;
# Specify a charset
# https://nginx.org/en/docs/http/ngx_http_charset_module.html#charset
charset utf-8;
# Update charset_types to match updated mime.types.
# text/html is always included by charset module.
# Default: text/html text/xml text/plain text/vnd.wap.wml application/javascript application/rss+xml
# https://nginx.org/en/docs/http/ngx_http_charset_module.html#charset_types
charset_types
text/css
text/plain
text/vnd.wap.wml
text/javascript
application/json
application/rss+xml
application/xml;
# Include $http_x_forwarded_for within default format used in log files # Include $http_x_forwarded_for within default format used in log files
# https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format # https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format