# define Nginx running userUser root;# Nginx Process number, set to auto on behalf of Nginx will match itself, generally the number of CPU coresWorker_processes Auto;# Error log path and levelError_log Logs/error.log Notice;# PID File storage locationPID Logs/nginx.pid;# nginx Maximum file open numberWorker_rlimit_nofile40960; Events {#参考事件模型, use [kqueue | rtsig | epoll |/dev/poll | select | poll]; EPOLL model is a high-performance network I/O model in Linux 2.6 and above, if run on FreeBSD, Just use the Kqueue model. Use Epoll;#单个进程最大连接数 (maximum number of connections = number of connections * processes)Worker_connections10240;#在Nginx接到一个新连接通知后调用accept () to accept as many connections as possibleMulti_accept on; }http {# Hide Nginx version numberServer_tokens off;# file name extension with file type mapping tableInclude Mime.types;# Default File typeDefault_type Application/octet-stream;# nginx Log FormatLog_format Main' $remote _addr| $time _local| $request | '' $status | $body _bytes_sent| $http _referer| '' $http _user_agent| $http _x_forwarded_for| '' $upstream _addr| $upstream _status| $request _time| $upstream _response_time ';# define the access log and use the format defined aboveAccess_log Logs/access.log Main;# Request Head Cache sizeClient_header_buffer_size4K# Request Cache SizeLarge_client_header_buffers4 +K#允许客户端请求的最大单文件字节数Client_max_body_size -M#缓冲区代理缓冲用户端请求的最大字节数Client_body_buffer_size1024x768K#后端的Web服务器可以通过X-forwarded-for Get the user real IPProxy_headers_hash_max_size51200; Proxy_headers_hash_bucket_size6400; Proxy_set_header X-real-ip $remote _addr; Proxy_set_header x-forwarded-for $remote _addr; Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for; Proxy_set_header Request_uri $request _uri; Proxy_set_header Host $host;#nginx跟后端服务器连接超时时间 (proxy connection timed out)Proxy_connect_timeout -;#后端服务器数据回传时间 (proxy send timeout)Proxy_send_timeout -;#连接成功后, back-end server response time (proxy receive timeout)Proxy_read_timeout -;#设置代理服务器 (nginx) buffer size for saving user header informationProxy_buffer_size -K#proxy_buffers缓冲区, the average Web page is set below 32kProxy_buffers8 -K#高负荷下缓冲大小 (proxy_buffers*2)Proxy_busy_buffers_size theK#高负荷下缓冲大小 (proxy_buffers*2)Proxy_temp_file_write_size theK Proxy_temp_path/usr/local/nginx/proxy_temp; Proxy_cache_path/usr/local/nginx/proxy_cache levels=1:2keys_z>100M inactive=1D max_size=TenG#开启高效文件传输模式, the sendfile instruction specifies whether Nginx calls the Sendfile function to output the file, and for normal applications to be set to ON, if it is used for downloading applications such as disk IO heavy load applications, can be off to balance disk and network I/O processing speed, Reduce the load on the system. Note: If the picture does not appear normal, change this to off. Sendfile on;#防止网络阻塞Tcp_nopush on;#防止网络阻塞Tcp_nodelay on;#长连接超时时间, unit of secondsKeepalive_timeout -;#gzip模块设置gzip on;#开启gzip压缩输出Gzip_min_length1K#最小压缩文件大小Gzip_buffers4 -K#压缩缓冲区Gzip_comp_level4;#压缩等级Gzip_proxied any; Gzip_types image/jpeg image/png text/plain application/xml application/x-javascript text/javascript text/css;#压缩类型, the default is already included text/html, so there is no need to write, write up will not have a problem, but there will be a warn. Gzip_vary on;#限制请求数, up to 8 requests per second, except for whitelisted IPLimit_req_zone $binary _remote_addr z>20M rate=1r/s;#限制连接数Limit_conn_zone $binary _remote_addr z>20M#限制连接数, white list of requestsGeo $white _ip {ranges;default0; #白名单ip-11.1. 1. 1-1.1. 1. 21;1.1. 1. 1-1.1. 1. 21;1.1. 1. 1-1.1. 1. 21;1.1. 1. 1-1.1. 1. 21; #白名单ip-21.1. 1. 1-1.1. 1. 21;1.1. 1. 1-1.1. 1. 21; } limit_req_whitelist geo_var_name=white_ip geo_var_value=1;#----------------------------------server {Listen the; server_name *.xxx.net xxx.net *.xxx.com xxx.com *.xxx.cn xxx.cn *.xxx.com *.xxx.com.cn xxx.com.cn; Rewrite ^ (. *) http://www.xxx.com$1 Permanent;} server{Listen thedefault; server_name _;return444; }# Load the configuration under this directoryInclude/usr/local/nginx/conf/vhost/*.conf;# Error code (403, 404, 50x) page Error_page 403 http://file.xxx.com/assets/errorNew.html; Error_page 404 http://cdn1.xxx.com/assets/error.html; Error_page 502 503 504 http://cdn1.xxx.com/assets/error.html;}
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the Nginx configuration file summary, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.