1. Functions
1.1.Function Description
Use reverse proxy for cache acceleration, simple load balancing and fault tolerance;
Use the cache mechanism to accelerate access to remote FastCGI servers;
Modular structure;
Basic HTTP Functions;
Email proxy server function;
Scalable Architecture: non-blocking, time-driven, multiple workers of one master, highly modular;
The main roles are reverse proxy and CDN cache service.
1.2.Basic module
Kernel module, event driver module, mail module, and service module
Example of related configuration parameters:
Kernel module parameter env \ error_log \ master_process \ User \ worker_cpu_affinity \ worker_processes;
Event module parameter worker_connections \ use;
The maximum number of client connections can be calculated using the work_connections and worker_processes commands:
Max_clients = work_connections * worker_processes;
In the reverse proxy environment, the maximum number of customer connections is changed:
Max_clients = worker_processes * worker_connection/4
The reason is that by default, the next browser will open two connections to the server. nginx uses the file descriptor from the same pool to connect to the upstream server.
HTTP module parameter AIO \ alias \ directio \ error_page \ Listen \ Server \ location \ Root \ SERVER_NAME \ types
2. Process Management
2.1.MasterProcess andWorkerProcess
Indicates the master process and worker process, respectively,
The main process processes the following signals: Term \ int \ user1 \ user2 \ Hup \ winch \ quit;
Workprocess: Term \ int \ user1
2.2.WorkerQuantity settings
The number of settings can be the same as the number of CPU cores. It is best to reduce one because the Linux system uses the CPU
2.3.ForNginxPairLinuxSystem Optimization
Shut down services not required by the system;
Optimized disk write operations to reduce disk write operations during nginx access;
Optimize resource restrictions, such as setting the number of files that can be opened and the number of processes, and use ulimint-N and ulimit-U;
Optimize kernel TCP options
2.4.OptimizationNginxServer
Disable access logs;
Use epoll
Server Configuration Optimization: for example
Worker_connection 65535
Keepalive_timeout 60
Client_header_buffer_size 8 K
Worker_rlimit_nofile 65535.