user nobody;
worker_processes 10;
error_log /logs/error.log;
#定义出错的log
#pid logs/nginx.pid;
events {
use epoll;
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
access_log off;
#关闭了access log.也可以去打开.
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#压缩传输,减少带宽.
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_types text/plain application/x-javascript text/css text/html application/xml image/jpeg image/png image/gif;
upstream backend{
server 192.168.1.100:80 weight=1;
server 192.168.1.1001:80 weight=1;
#weight是权重,如果想往那台机器多分点流量,就加大那个数字吧.
}
server {
listen 80;
server_name www.it.net.cn;
location / {
#internal;
proxy_pass http://backend/;
#proxy_store on;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
index index.html index.php index.htm;
}
location /NginxStatus {
stub_status on;
access_log on;
auth_basic "NginxStatus";
}
}
}