Selectively Disabling HTTP/1.0 and HTTP/1.1 http { ... # Check for text-based browsers map $http_user_agent $is_text_browser { default 0; # Text-Based Browsers (not exhaustive) "~*^w3m" 1; "~*^Links" 1; …
Nginx
All posts
Harden a Server with Fail2Ban + nftables
NGINX Native ACME Support: Rethinking TLS Automation from the Ground Up ngx_http_acme_module NGINX 1.25.1 Pre-install # Install build tools and NGINX dependencies on Debian/Ubuntu sudo apt update sudo apt …
Reduce the Chance of Home Web Services Being Reported When a plaintext request hits an HTTPS service, Nginx returns a special 497 status code. If that happens, we want Nginx to close the connection and return …
Nginx if 避坑指南 If is Evil… when used in location context if 指令由 rewrite 模块提供,显然它主要是用于 URL 重写领域。典型的 if 用法如下: http { server { listen 8080; if ($http_user_agent ~ MSIE) { rewrite ^(.*)$ /msie/$1 break; } if …
Avoiding the Top 10 NGINX Configuration Mistakes - NGINX 1) Not enough file descriptors (FDs) per worker What’s wrong worker_connections limits how many concurrent connections a single worker can hold (default …
Top 25 Nginx Tips and Tricks From Practical Experience server_tokens off; ssl_protocols TLSv1.2 TLSv1.3; Disable any undesirable HTTP methods location / { limit_except GET HEAD POST { deny all; } } Enable …
Simple A/B Testing with Nginx split_clients ngx_http_split_clients_module Configure For example, suppose we want 20% of users to be redirected to https://example.com/, 30% to https://example.org/, and the rest …
How Nginx Hides Upstream Errors Nginx allows enabling next upstream for the following seven retryable error codes 403 Forbidden 404 Not Found 429 Too Many Requests 500 Internal Server Error 502 Bad Gateway 503 …
Notes about Nginx configs
Fix Nginx 500 errors (too many open files, connection) Nginx 500 errors only show up in logs. Two common cases: socket() failed (24: Too many open files) while connecting to upstream $ sudo su - www-data $ …
Nginx request_time and upstream_response_time explained Time definitions request_time Time from the first byte of the client request to the completion of response data being sent. $request_time includes time …