Enabling content-type application/json for all the json files in nginx Enabling content-type application/json for all the json files in nginx json json

Enabling content-type application/json for all the json files in nginx


OK, I fix this problem .

  • Should modify ./conf/mime.types.default add
    application/json json;

  • ./sbin/nginx -s reload


If your json file has no extension, in test phrase you can modify the nginx.conf to something like this:

http {    ...    default_type application/json;    ...}

Then the files without extension are served with Content-Type: application/json.