Nginx server commonly used configuration quick tips

# Block certain subdomains' access of your site
server {
    listen 80;
    listen 443 ssl;
    server_name  sub_domain_to_be_rejected;
    return 444;
}
# Allow certain IPs to access to your domain and subdomains
server {
  server_name domain_or_subdomain;
  allow 12.34.56.89; // IP address you want to allow
  deny all; // Will deny all other IPs.
}

Leave a Comment