When debugging command location, location directly to output text

Sometimes we want to be able to output text location instruction directly, so we can easily debug debug command location. Then we can use the echo module to achieve, but in most cases we do not install this module, we can also use another method to implement this idea

  Direct return text

location / {
  default-type text/plain;
  return 502 "this is a test message";        
}

  html tag format

location / {
  default-type text/html;
  return 502 "this is a test message";        
}

  Return json text

location / {
            default_type application/json;
            return 502 '{"name":"mayuan","age":18}';
        }

 

Guess you like

Origin www.cnblogs.com/itsuibi/p/11515035.html