user nobody nobody; //用户和用户组
worker_processes 4; //指定工作进程数(一般设置为CPU总核数或2*CPU总核数)
error_log logs/error.log crit; //错误日志路径及级别[debug|info|warn|error|crit]
pid logs/nginx.pid;
worker_rlimit_nofile 65535; //指定文件描述符数量
events {
use epoll; //使用网络IO模型,Linux系统采用epoll,freebsd采用kqueue
worker_connections 65535; //最大连接数
}
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
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 logs/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
include vhost/hd.conf;
}
配置文件结构如下:
......
events
{
......
}
http
{
......
server
{
......
}
server
{
......
}
......
} 本文出自 “燕雀安知鸿鹄之志哉” 博客,请务必保留此出处http://who0168.blog.51cto.com/253401/569535
拥有帝国一切,皆有可能。欢迎访问phome.net |