#nginx用户和组   windows下不指定

#user nobody;

#工作进程数目

worker_processes 4;

#错误日志存放路径

error_log logs/error.log crit;
#error_log logs/error.log notice;
#error_log logs/error.log info;


#pid进程标识符 存放路径

#pid logs/nginx.pid;

events {
#每个工作进程的最大连接数量
worker_connections 1024;
}


##设定http服务器,利用它的反向代理功能提供负载均衡支持
http {
#设定mime类型,类型由mime.type文件定义
include mime.types;
default_type application/octet-stream;

#保存服务器名字的hash表是由指令server_names_hash_max_size 和server_names_hash_bucket_size所控制的。参数hash bucket size总是等于hash表的大小,并且是一路处理器缓存大小的倍数。
server_names_hash_bucket_size 512;

#客户端请求头部的缓冲区大小
client_header_buffer_size 32k;


#客户请求头缓冲大小。nginx默认会用client_header_buffer_size这个buffer来读取header值,如果header过大,它会使用large_client_header_buffers来读取。
large_client_header_buffers 4 32k;
#设定通过nginx上传文件的大小
client_max_body_size 100m;

#sendfile指令指定 nginx 是否调用sendfile 函数(zero copy 方式)来输出文件,对于普通应用,必须设为on。如果用来进行下载等应用磁盘IO重负载应用,可设置为off,以平衡磁盘与网络IO处理速度,降低系统uptime。
sendfile on;

#此选项允许或禁止使用socke的TCP_CORK的选项,此选项仅在使用sendfile的时候使用
tcp_nopush on;

#keepalivea超时时间
keepalive_timeout 60;

tcp_nodelay on;


## 使用fastcgi,服务器收到请求后将不会fork()进程,
# 连接到后端 fastcgi 超时时间
fastcgi_connect_timeout 300;
# 向 fastcgi 请求超时时间(这个指定值已经完成两次握手后向fastcgi传送请求的超时时间)
fastcgi_send_timeout 300;
# 接收 fastcgi 应答超时时间,同理也是2次握手后
fastcgi_read_timeout 300;
# 读取 fastcgi 应答第一部分需要多大缓冲区
fastcgi_buffer_size 64k;
# 指定本地需要多少和多大的缓冲区来缓冲fastcgi应答请求
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;

gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";


# 配置虚拟机
server {
#默认80端口
listen 80;

#配置访问域名
server_name _;
autoindex on;
index index.html index.htm index.php;
root G:/phpEnv/server/nginx/html/;

access_log logs/access.log;

location = /favicon.ico {
log_not_found off;
access_log off;
}
}

# 加载所有.conf文件
include vhosts/*.conf;
}


(以上资料内容侵删) 转载时请告知(以上资料内容侵删) 每个人都知道的,哪怕已经很糟糕了但是努力生活依旧很重要。