User www www;
Worker_processes 4;
Worker_cpu_affinity 0001 0010 0100 1000;
Error_log/data1/logs/nginx-1.7.4/error.log debug_http;
Pid/data/program/nginx-1.7.4/logs/nginx.pid;
Worker_rlimit_nofile 204800;
Events {
Use Epoll;
Worker_connections 20480;
Multi_accept on;
Accept_mutex off;
}
HTTP {
Include Mime.types;
Default_type Application/octet-stream;
Log_format access ' $http _x_forwarded_for $remote _addr [$time _local] "$request"
' $status $body _bytes_sent ' $http _referer '
' $http _user_agent ';
Sendfile on;
Tcp_nodelay on;
Tcp_nopush on;
Server_tokens off; #关闭版本显示
Fastcgi_connect_timeout 300;
Fastcgi_send_timeout 300;
Fastcgi_read_timeout 300;
Fastcgi_buffer_size 256k;
Fastcgi_buffers 256k;
Fastcgi_busy_buffers_size 512k;
Fastcgi_temp_file_write_size 512k;
#设定请求缓冲
Server_names_hash_bucket_size 128;
Client_body_buffer_size 128K;
Client_header_buffer_size 16k;
Large_client_header_buffers 4 64k;
Client_max_body_size 1G;
Client_body_timeout 30;
Client_header_timeout 10;
Keepalive_timeout 65;
Send_timeout 30;
Reset_timedout_connection on;
Proxy_connect_timeout 110;
Proxy_send_timeout 110;
Proxy_read_timeout 110;
Proxy_buffer_size 128k;
Proxy_buffers 4 256k;
Proxy_busy_buffers_size 256k;
Proxy_temp_file_write_size 64m;
Proxy_ignore_client_abort on;
Open_file_cache max=204800 inactive=20s;
Open_file_cache_min_uses 1;
Open_file_cache_valid 30s;
#开启gzip模块
gzip on;
Gzip_min_length 1k;
Gzip_http_version 1.1;
Gzip_buffers 8 32k;
Gzip_comp_level 2; #0-9 The default value is 1, the higher the value, the higher the compression rate, the more CPU resources consumed, the smaller the transfer volume
Gzip_types Text/css Application/x-javascript;
Gzip_vary on;
#gzip_static on;
Gzip_proxied any;
Gzip_disable "MSIE [1-6]\.";
Output_buffers 1 32k;
Postpone_output 1460;
server {
Listen default_server;
Access_log off;
server_name _; #default
return 444;
}
#server {
#Listen 6428;
#Access_log off;
#
#location/{
#index index.html;
#root/data/wwwroot/slb;
#expires 30d;
#}
#
#error_page 502 503 504/50x.html;
#location =/50x.html {
#root html;
#}
#}
#
Include site/*.conf;
}
server {
Listen 80;
server_name store-admin-test.nubia.cn;
ACCESS_LOG/TMP/DDD;
Location/{
Proxy_pass http://localhost:8007;
Proxy_http_version 1.1;
Proxy_set_header Connection "";
Proxy_redirect off;
Proxy_set_header accept-encoding ' gzip ';
Proxy_set_header Host $http _host;
Proxy_set_header X-real-ip $proxy _add_x_forwarded_for;
# $http _x_forwarded_for;
# $remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
Proxy_set_header Cookie $http _cookie;
#chunked_transfer_encoding off;
}
Location ~ ^/(Web-inf)/{
Deny all;
}
Error_page 403 404 502 503 504/error.html;
}
This article from "8159085" blog, declined reprint!
03.Nginx Configuration