I'd like to add a few extra types to nginx mime types, but I don't want to edit the default /etc/nginx/mime.types
as it would add some extra complexity to the deployment process.
If I add a types {...}
section to my nginx.conf
it will override all the other types that were declared with the include mime.types;
.
I've thought that I could write a location rule for the extensions of the files that I need to handle, but I suppose that there must be a cleaner way to achieve this.
MIME files are more commonly seen using a . MIM extension.
The default mime. types file from nginx only contains MIME types for more or less common file extensions. And it certainly isn't very common to have json static files. Also, what types should be gzipped? You may include MIME types for all well compressible content that you have on your site.
In the Connections pane, go to the site, application, or directory for which you want to add a MIME type. In the Home pane, double-click MIME Types. In the MIME Types pane, click Add... in the Actions pane. In the Add MIME Type dialog box, add the file name extension and MIME type, and then click OK.
By default, the configuration file is named nginx. conf and placed in the directory /usr/local/nginx/conf , /etc/nginx , or /usr/local/etc/nginx .
If I add a types {...} section to my nginx.conf it will override all the other types that were declared with the include mime.types;.
No, it won't.
You just need to specify additional types on the same level as your mime.types
include:
include mime.types; types { # here are additional types application/javascript mjs; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With