Nginx主配置文件

2019-03-11
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
user  nginx;  #主进程的用户
worker_processes 1; #与cpu核心相关

error_log /var/log/nginx/error.log warn; #错误日志
pid /var/run/nginx.pid; #pid进程

events {
worker_connections 1024; #每个进程所处理的最大连接数
}

http {
include /etc/nginx/mime.types; #和content-type相关
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 /var/log/nginx/access.log main; #http的访问日志,用于流量分析

sendfile on; #默认打开,提供IO效率
#tcp_nopush on;

keepalive_timeout 65; #连接保持时间

#gzip on; #压缩传输

include /etc/nginx/conf.d/*.conf; #包含其他配置文件
}