Block IP range

Block a subnet and specific IP in nginx location/server block

deny 192.168.1.0/24; deny 10.0.0.1; allow all;

tool
nginx15 commands
tags
nginxsecurity

More nginx commands

  • location /ws/ { proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; }

    WebSocket proxy with required Upgrade headers

  • nginx -t

    Validate nginx.conf without reloading

  • nginx -s reload

    Gracefully reload config — zero connection drop

  • nginx -V 2>&1 | tr ' ' '\n' | grep module

    List all built-in and dynamic modules in the binary

  • tail -f /var/log/nginx/access.log | awk '{print $1, $7, $9, $10}'

    Stream IP, path, status code, and response size

all 15 nginx commands