nginx负载均衡配置文件



nginx 负载均衡配置文件 (注意在使用该文件的时候要备份)

worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
worker_rlimit_nofile 409600;
events {
use epoll;
worker_connections 204800;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_tokens off;
server_names_hash_bucket_size 128;
upstream BeaconWeb{
server 10.125.42.81;
server 10.125.42.83;
server 10.125.42.84;
}
log_format ups ‘$remote_addr [$time_local] $request $status ‘
‘u_content_t $upstream_http_content_type ‘
‘u_addr $upstream_addr ‘
‘u_status $upstream_status ‘
‘u_rsp_ti $upstream_response_time ‘
‘$http_user_agent’ ;
server {
listen 80;
server_name localhost;
location / {
access_log /dev/shm/access.log ups;
proxy_redirect off;
proxy_pass http://BeaconWeb;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_set_header Host $remote_addr;
proxy_set_header remote_addr $remote_addr;
proxy_hide_header Host;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /ss
{
stub_status on;
access_log off;
allow 127.0.0.1;
allow 10.0.0.0/8;
deny all;

}
}
}
安装参数:
–prefix=/opt/dicc/nginx –with-pcre=/root/pcre-8.02 –with-http_ssl_module –with-http_stub_status_module –with-http_realip_module –without-http_autoindex_module