Block an IP range

Block a subnet and a single IP inside a server or location 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 the required Upgrade and Connection headers

  • nginx -t

    Check the nginx config syntax without reloading

  • nginx -s reload

    Reload the config gracefully without dropping open connections

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

    List built-in and dynamic modules from the build options

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

    Stream client IP, path, status code and response size

all 15 nginx commands