呵呵 说来搞笑 我们公司领导那个决定啊,公司的图片Windows服务机器 准备迁移到Linux,我勒个去,也不搞个正规的文件系统,先喷下公司 2.8KW 张零碎图片 1.8T 文件占有量,

 哥刚刚接手也是被吓了一跳。 Nginx 带动 整个公司核新图片业务,I/0 老高  访问速度龟速,上头给俺的任务就是立马先搞定龟速问题。俺花了一小天的时间搞好所有nginx 配置 速度快了几倍,不多说 贴上配置

events {
      worker_connections  65535;
      use epoll;
          }
http {
    include       mime.types;

    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                     '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;
    access_log  off;

    charset utf-8;

    keepalive_timeout 60;

    sendfile        off;

    tcp_nopush     off;

    client_header_buffer_size 8k;

    large_client_header_buffers 8 128k;

    client_max_body_size 300m;

    client_body_buffer_size 2048k;

    gzip        off;

     server {
        server_name _;
#       rewrite (.*)$ /opt/nginx/html/404.html?;
        return 404;
        error_page 404 = /opt/nginx/html/404.html;
        }


    include    nginx-upload.conf;

 


        server
                {

                        listen       80;
                        server_name  file.xxx.com;
                        root /usr/local/wwwweb/file.xxx.com;

                        #access_log  /opt/nginx/logs/file.xxx.com;
                        access_log  off;

 

 


        location  ~ .*\.(gif|jpg|jpeg|png)$ {
           root /usr/local/wwwweb/file.xxxx.com;

           #if ( !-f request_name  ) {
           if ( $status = 404  ) {

                     rewrite /(.*)\.jpg      /$1.JPG;
                     rewrite /(.*)\.JPG      /$1.jpg;
           }

        }

   }
}