1user www-data www-data;
2worker_processes 8; #工作进程,根据硬件调整,大于等于cpu核数
3
4error_log /var/nginx/log/error.log;
5pid /var/nginx/run/nginx.pid;
6
7worker_rlimit_nofile 65535; #指定进程可以打开的最大描述符. 这个指令是指当一个nginx进程打开的最多文件描述符数目,理论值应该是最多打开文件数(ulimit -n)与nginx进程数相除,但是nginx分配请求并不是那么均匀,所以最好与ulimit -n 的值保持一致
8
9
10
11http {
12 include /etc/nginx/mime.types;
13
14 access_log /var/nginx/log/access.log;
15
16 sendfile on;
17 #tcp_nopush on;
18
19 #keepalive_timeout 0;
20 keepalive_timeout 65;
21 tcp_nodelay on;
22
23 # 当使用nginx做反向代理时, 如果设置太小会造成502错误
24 # upstream sent too big header while reading response header from upstream
25 proxy_buffer_size 128k;
26 proxy_buffers 4 256k;
27 proxy_busy_buffers_size 256k;
28
29 # 当使用nginx做fastcgi时, 如果设置太小会造成502错误
30 # upstream sent too big header while reading response header from upstream
31 fastcgi_buffers 8 16k;
32 fastcgi_buffer_size 32k;
33
34 # 保存服务器名字的hash表是由指令 server_names_hash_max_size 和 server_names_hash_bucket_size所控制的
35 # 如果Nginx给出需要增大 hash max size 或 hash bucket size的提示,那么首要的是增大前一个参数的大小
36 # 当nginx server数据太多时, 需要增加此配置(默认是32的倍数)
37 server_names_hash_bucket_size 512;
38
39
40 gzip on;
41 gzip_disable "MSIE [1-6]\.(?!.*SV1)";
42
43
44 include /etc/nginx/sites-enabled/*;
45
46}
47
48# mail {
49# # See sample authentication script at:
50# # http://wiki.nginx.org/NginxImapAuthenticateWithApachePhpScript
51#
52# # auth_http localhost/auth.php;
53# # pop3_capabilities "TOP" "USER";
54# # imap_capabilities "IMAP4rev1" "UIDPLUS";
55#
56# server {
57# listen localhost:110;
58# protocol pop3;
59# proxy on;
60# }
61#
62# server {
63# listen localhost:143;
64# protocol imap;
65# proxy on;
66# }
67# }