
Disable Direct IP Address Access in Nginx on Linux
Nginx's server_name directive indicates the domain name it's listening on. But if non of the server blocks match the incoming request, it will still fall back to the last HTTP/HTTPS server block. So a direct access by IP address will probably caught by some route instead of being dropped, which is often not ideal.