Web siteme hizmet etmek için nginx kullanıyorum. Sitemin alanıyla eşleşmeyen bir HTTP "Ana Bilgisayar" üstbilgisi ile gelen tüm istekleri engellemek istiyorum.
Daha somut olmak için, nginx.conf bu iki sunucu bloğunu içerir:
server {
# Redirect from the old domain to the new domain; also redirect
# from www.newdomain.com to newdomain.com without the "www"
server_name www.olddomain.com olddomain.com www.newdomain.com;
listen 80;
return 301 $scheme://newdomain.com$request_uri;
}
server {
server_name newdomain.com localhost;
listen 80;
# Actual configuration goes here...
}
Ana Bilgisayarı www.olddomain.com, olddomain.com, www.newdomain.com veya newdomain.com olmayan trafiği engellemek (yani, bir 444 durum kodu "döndürmek") istiyorum. Bunu nasıl yapabilirim?