# Nginx 最小配置文件解析

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 工作进程个数
worker_processes 1;
events {
# 每个worker可以创建多少个连接
worker_connections 1024;
}

http {
# 引入其他配置文件
include mime.types;
# 默认类型 数据流
default_type application/octet-strean;
# 数据零拷贝
sendfile on;
keepalive_timeout 65;

# 虚拟主机 vhost
server {
listen 80;
# 域名, 主机名
server_name localhost;
location / {
# 路径匹配上之后, 从哪个目录查找资源, 相对路径(相对于nginx目录)
root html;
index index.html index.htm;
}
# 发生服务器内部配置时展现的页面
error_page 500 502 503 504 /50x.html;
localtion = /50x.html {
root html;
}
}
}