I want to redirect to 444 when someone uses the IP address. Most online says to use the underscore to catch all but I currently have a block that uses that to redirect http to https:
listen 80; listen 443 ssl; server_name _; ssl_certificate /etc/ssl/nginx.crt; ssl_certificate_key /etc/ssl/nginx.key; return 301 https://$host$request_uri; } What's the best way to include both without having to use a If statement?
serverblock (what you've given), or you can use alocationdirective.default_serveron thelistendirective. See this document.