# 包含
include /etc/nginx/conf.d/*.conf
# user 设置nginx的worker使用的用户
# worker_process 工作进程数量,保持和cpu的核心一致
# error_log path/xxx 服务错误日志
# pid nginx的pid的记录
#events epoll模型的
worker_connections 每个worker进程最大的并发连接数65535
use 设置nginx使用的内核模型,需要系统比如linux支持
#http配置
http{
....
sendfile on; //静态文件内核态传输开关
keepalive-timeout 65; //客户端和服务端的超时时间65s
server{
listen 80;//端口
//server_name xx.com; //域名
charset koi8-r; 字符编码
location / {
root /user/; //指定访问路径
index index.html index.htm; //指定默认访问的页面,找不到index.html,找index.htm
} //控制每层路径的访问
error_page 500 502 503 504 /50x.html; //给指定的返回错误状态码一个统一的错误页面
//这个页面路径又匹配到location 50x.html 进入html目录下
location = /50x.html {
root html;
}
}
server{} //站点
}