I am having trouble doing something so simple...
I have a service on my server that I configured to use a particular hostname which I have mapped with an A record. However I want to return a 403 error when this subdomain is accessed with a browser.
But it does not seem to work. I just followed the same steps I used to disallow web traffic from going to the ip address directly.
server {
listen 80;
server_name 155.155.155.155;
return 403;
}
This worked fine but when I do this
server {
listen 80;
server_name service.mydomain.com;
return 403;
}
It doesn't 403. It just goes to the Nginx test page.
What would be the elegant solution for doing something like this?