http {
include mime.types;
// 主模块;实现对配置文件包含的文件设定,可以减少主配置文件的复杂度;
default_type application/octet-stream;
// http 的核心模块指令;默认是设置为二进制流;就是当文件类型未定义时使用这种解析;例如不配置PHP时打开PHP文件就是下载;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
// 日志输入格式; main就是日志输入格式的名称; 在下面access_log 中引用;
#access_log logs/access.log main;
sendfile on;
// 开启高效文件传输模式; 开启下面两个可以有效防止网络阻塞;
#tcp_nodely on;
#tcp_nopush on;
charset utf-8;
// html 字符集格式 ;
server_names_hash_bucket_size 128;
// 多虚拟主机服务器名字的hash表大小
client_max_body_size 8m;
// 客户端请求的最大的单个文件字节数
client_header_buffer_size 32k;
// 客户端请求 client_header_buffer 大小;1KB 缓冲区就是很大的;
large_client_header_buffers 4 32k;
// 客户端请求中较大的消息头的缓存最大数量和大小。
#keepalive_timeout 0;
keepalive_timeout 65;
// 客户端链接保持活动的超时时间 ;
client_body_timeout 10;
// 客户端请求主题读取时间 默认是60;超时提示 request time out (408)
client_header_timeout 10;
// 客户端请求头读取的超时时间; 如果没返回数据 提示也是 request time out (408)
send_timeout 10;
// 设置响应客户端的超时时间;