Nginx server commonly used configuration quick tips

List commonly used use cases for nginx server configuration

Block domains that you want no access

# Block certain subdomains' access of your site
server {
    listen 80;
    listen 443 ssl;
    server_name  sub_domain_to_be_rejected;
    return 444;
}

White list domains that can access

# 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

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

Scroll to Top