August 2017
Intermediate to advanced
278 pages
8h 53m
English
Tracking connections via the client IP address isn't the only way we can limit connections. We can also set a limit for the server as a whole, which can be handy for preventing the server from being overloaded. Especially, where the system is behind a reverse proxy, this can be a simple yet effective way of ensuring that your website or application remains responsive.
To track for the server as a whole, we again first set the shared memory zone:
limit_conn_zone $server_name zone=serverlimitzone:10m;
Then, we set our server directive:
server { listen 80; server_name limitcon.nginxcookbook.com; access_log /var/log/nginx/limitcon.log combined; location / { root /var/www/html; limit_conn serverlimitzone 500; index index.html ...Read now
Unlock full access