# 开启几个worker进程,对应cpu核心数worker_processes 1;# 事件驱动模块events{# 每一个worker进程可以创建多少的连接worker_connections 1024;}# http块http{# 引用其他配置文件 mime.types返回的http头是什么类型的(让浏览器解析用的)include mime.types;# default_type 默认类型,不包含在mime.types中的配置default_type application/octet-stream;# 数据0拷贝 read write过程省略,网络接口缓存直接读取文件sendfile on;# 保持连接超时时间keepalive_timeout 65;# server块 虚拟主机。vhost# 一个server代表一个主机 每个主机互不干扰server{# 一个主机的监听端口号listen 80;# 域名、主机名server_name localhost;# 匹配域名后的资源。urilocation /{# 匹配location后去哪个目录找资源 相对路径root html;# 默认页index index.html index.ntml;# 错误页面 转向到内部某个地址error_page 500 502 503 504 /50x.html;location = /50x.html{# 指向root下htmlroot html;}}}}
sendfile:
