03.Nginx配置

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 16 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 默認值爲1,值越大壓縮率越高,消耗的cpu資源越多,傳輸量減小

    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       80 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   500 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 500 502 503 504  /error.html;

}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章