1. After Nginx is installed, the value of default_type is configured as application/octet-stream
by default, and many domain names have been configured so far, rashly modifying such a global configuration may cause unusable problems
2. Files ending in html, placed in the root directory of the website will be recognized as text/html
by default.
3. But today’s feedback file has no suffix, so it becomes application/octet-stream
by default, and the browser request will be downloaded directly instead of displaying the file content
4. Perform a separate configuration for this file, as follows
server { include local_ssl_port.conf; include ssl/ssl.conf; server_name xxx.somedomain.com; root /data/project/blog; include expires.conf; location / { # Here the individually targeted configuration default_type is the required format default_type text/html; } }
5. Test the browser again and display it as the file content
…
The post Nginx modifies the default Content-Type value to solve the problem that the server file becomes download when there is no extension first appeared on Lenix Blog .
This article is reprinted from https://blog.p2hp.com/archives/9374
This site is for inclusion only, and the copyright belongs to the original author.