This is my configuration:
server {
listen 80;
listen [::]:80;
server_name domain.tld www.domain.tld;
return 301 https://erp.uni.mk$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name domain.tld;
ssl_certificate "/etc/nginx/ssl/ca_full.crt";
ssl_certificate_key "/etc/nginx/ssl/private.key";
...
}
What I am trying to achieve is block access via the IP. And only allow it via the domain.
I've seen some solutions with regex, but I am using both IPv4 and IPv6. And it should not impact performance.
Any suggestions how to solve this?