I wrote this /etc/nginx/conf.d/apply.conf
and started nginx.
server {
location = /hoge {
return 200;
}
}
but the curl command fails.
curl localhost:80/hoge
It says
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.13.9</center>
</body>
</html>
and the logs are
open() "/usr/share/nginx/html/hoge" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /hoge HTTP/1.1", host: "localhost"
I want to just return the status code without response body or with response body blank.
I changed to this but still not working.
location /hoge {
return 200 'Wow';
add_header Content-Type text/plain;
}
also tried this.
location /hoge {
return 200 'Wow';
default_type text/plain;
}