You can use a return statement in Nginx to send a plain text response.
In your Nginx server entry, add
location ~* "^/hello/(.*)" {
default_type text/plain;
return 200 "Hello $1\n";
}
Now you can access the page with the URL
boby@sok-01:~$ curl http://localhost/hello/World Hello World boby@sok-01:~$
Here is another example
location "/hello" {
default_type text/plain;
return 200 "Hello World\n";
}
For any URL starting with /hello, you get the “Hello World” response.
Back to Nginx

Leave a Reply