好物优选点击查看详情 京东购买

暂无内容

nginx反代mogilefs实现海量小文件存储

[root@shuishui ~] # vim /etc/nginx/nginx.conf

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;

     sendfile        on;

     #tcp_nopush     on;

     #keepalive_timeout  0;

     keepalive_timeout  65;

     gzip   on;

     upstream mogcluster {                 #定义upstream,做负载均衡轮调

         server  172.16.7.200:7001;

         server  172.16.7.201:7001;

         server  172.16.7.202:7001;

     }

     server {

         listen       80;

         server_name  localhost;

         #charset koi8-r;

         #access_log  logs/host.access.log  main;

         location / {

             root   html;

             index  index.html index.htm;

         }

         location  /images/  {                     #增加此location

             mogilefs_tracker mogcluster;

             mogilefs_domain images;

             mogilefs_methods GET PUT DELETE;

             mogilefs_pass {

                 proxy_pass $mogilefs_path;

                 proxy_hide_header Content-Type;

                 proxy_buffering off;

             }

         }

         # redirect server error pages to the static page /50x.html

         #

         error_page   500 502 503 504   /50x .html;

             root   html;

         }

     }

}

原文链接:https://developer.aliyun.com/article/475803

© 版权声明
THE END
喜欢就支持一下吧
点赞12 分享