#users and groups to useuser www www;#Specify the number of work-derived processes (typically equal to twice times the total number of cores or total cores of the CPU, such as two quad-core CPUs, the total number of cores is 8)Worker_processes 8;#specify the path where the error log is stored, the error logging level can be selected as: [Debug | info | notice | warn | error | crit]Error_log/data1/logs/nginx_error.LogCrit;#specify the path where the PID is storedPid/usr/local/webserver/nginx/nginx.pid;#Specify the number of file descriptorsWorker_rlimit_nofile 51200; events{#using the network I/O model, the Linux system recommends using the Epoll model, and the FreeBSD system recommends using the Kqueue model UseEpoll; #number of connections allowedWorker_connections 51200;} http{includeMime.types; Default_type Application/octet-stream; #set the character set used, if a Web site has multiple character sets, do not set casually, should let the programmer in the HTML code through the META tag settings #CharSet gb2312;server_names_hash_bucket_size128; Client_header_buffer_size 32k; Large_client_header_buffers432k; #set the file size that clients can uploadclient_max_body_size 8m; Sendfile on; Tcp_nopush on; Keepalive_timeout60; Tcp_nodelay on; Fastcgi_connect_timeout300; Fastcgi_send_timeout300; Fastcgi_read_timeout300; Fastcgi_buffer_size 64k; Fastcgi_buffers464k; Fastcgi_busy_buffers_size 128k; Fastcgi_temp_file_write_size 128k; #turn on gzip compressiongzip on; Gzip_min_length 1k; Gzip_buffers416k; Gzip_http_version1.1; Gzip_comp_level2; Gzip_types text/plain Application/x-javascript text/css application/XML; Gzip_vary on; #limit_zone crawler $binary _remote_addr 10m;Server {Listen80; server_name www. yourdomain.com yourdomain.com; Index index. HTML index.htm Index.PHP; Root/data0/Htdocs; #limit_conn crawler; Location~ .*\. (gif|jpg|jpeg|png|bmp|swf) $ {expires 30d; } Location~ .*\. (JS|CSS)?$ {Expires 1h; } Log_format Access' $remote _addr-$remote _user [$time _local] "$request" ' $status $body _bytes_sent ' $http _referer ' ' "$http _user_agent $http _x_forwarded_for '; Access_log/data1/logs/access.Logaccess; }}
Nginx General Configuration Instance static page