Nginx服务器配置主要参数
worker_processes 16;
worker_cpu_affinity 0000000000000001 0000000000000010 0000000000000100 0000000000001000 0000000000010000 0000000000100000 0000000001000000 0000000010000000 0000000100000000 0000001000000000 0000010000000000 0000100000000000 0001000000000000 0010000000000000 0100000000000000 1000000000000000;
www.zhishiwu.com
worker_rlimit_nofile 1024000;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 1024000;
}
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on; www.zhishiwu.com
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
open_file_cache max=1024000 inactive=60s;
open_file_cache_min_uses 1;
open_file_cache_valid 30s;
##cache##
proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_temp_path tmp/temp_dir;
proxy_cache_path tmp/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;
##end##
#gzip on;
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; www.zhishiwu.com
upstream in_pool
{
#ip_hash;
server 192.168.0.3:8080;
server 192.168.0.6:8080 backup;
server 192.168.0.9:8080 backup;
}
server {
listen 80;
server_name 192.168.60.30;
#charset koi8-r;
location ~ .*/.(gif|jpg|png|htm|html|css|js|flv|ico|swf)(.*) {
proxy_pass http://interface_pool ;
proxy_redirect off;
proxy_set_header Host $host;
proxy_cache cache_one;
proxy_cache_valid 200 302 1h;
proxy_cache_valid 301 1d;
proxy_cache_valid any 1m;
expires 30d;
} www.zhishiwu.com
location ~ .*/.(php)(.*){
proxy_pass http://interface_pool ;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ .*/.(jsp)(.*){
proxy_pass http://interface_pool ;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
作者 xiaoxin