NGINX
NGINX Internal Architecture
NGINX Internal Architecture
Link to original
Here the connection is managed by the kernel and later consumes by the NGINX worker process.
NGINX Use Cases
- Web Server
- Forward and Reverse Proxy > Reverse Proxy
- Load Balancer
- Backend Routing
- Caching - NGINX
- API Gateway
NGNIX as a Load Balancer
NGINX as a Load Balancer
Link to original
Here the frontend means the interface that is listening to the client requests and the backend is what is communicating with the services
Layer 4 and 7 Load Balancing
In layer 4 we see the TCP/IP stack and nothing about the app itself, we have access to the
- source IP, source port
- destination IP, destination port
- simple packet inspection (SYN/TCP hello)
using this we can log some really useful information about the application traffic
In layer 7 we see the application data, HTTP/gRPC
- we have more access to the context
- what URL they are visiting
- require decryption
- whenever you use a CDN - Content Delivery Network like Cloudflare or a proxy service they decrypt the traffic inorder to cache or store the response, which is not secure for highly confidential data, but our mileage may vary.
layer 4 is useful when NGINX server does not understand the protocol like a database connection protocol and layer 7 is useful when NGINX wants to share the backend connections and cache the results
use the stream context to become a layer 4 proxy, and http context for a layer 7 proxy
NGINX Timeouts
Nginx Timeouts
Link to original