worker_processes 4; #4核CPU
error_log logs/error.log info;
pid logs/nginx.pid;
worker_rlimit_nofile 65535;
use epoll;
worker_connections 65535;
#worker工作方式:串行
multi_accept on;
}
#文件扩展名与文件类型映射表
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
error_log logs/error.log crit;
#ccess_log off;
#charset utf-8;
client_header_buffer_size 32k;
#指定客户端请求中较大的消息头的缓存最大数量和大小。
large_client_header_buffers 4 64k;
#开启高效传输模式。
sendfile on;
#防止网络阻塞
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
client_header_timeout 10;
client_body_timeout 10;
send_timeout 10;
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
limit_conn_zone $binary_remote_addr zone=addr:10m;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:nginx网站标准配置 - Python技术站