#user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
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 off;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
client_max_body_size 100m;
client_body_buffer_size 1m;
proxy_buffers 16 10m;
proxy_buffer_size 10m;
# limit_req_zone $binary_remote_addr zone=perIP:1m rate=30r/m; #每个ip一个session,binary_remote_addr 长度为4字节,比remote_addr省空间,分配1m的内存空间存储session,空间代号:perIP,限制每ip每2秒一个请求,超出返回503
# limit_conn_zone $server_name zone=perServer:1m; #并发连接数限制
# limit_req zone=perIP burst=50 nodelay; #每ip允许超出50个连接(每个ip并发连接数),nodelay表示超出的连接也会被立即处理
# limit_conn perServer 100; #每个服务器总并发连接数限制(所有在处理的请求)
# limit_rate 500k; #每个连接带宽限制 bytes/s
gzip on;
gzip_http_version 1.0;
gzip_comp_level 6;
gzip_types text/xml text/plain text/css application/xml application/font-woff application/json application/xhtml+xml application/javascript image/jpeg image/gif image/png image/tiff image/x-icon image/svg+xml;
#负载均衡服务器列表
upstream backend {
#权值越高被分配到的机率越大
server 127.0.0.1:3000 weight=1;
}
server {
listen 80;
server_name localhost;
proxy_connect_timeout 10;
proxy_read_timeout 150;
proxy_send_timeout 15;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /mnt/editor/VGDesigner;
index index.html editor.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
# }
}
}