When preparing to use MogileFS to replace the company's existing file system, it has been plagued by file display, because static files such as images should also be output using Http Response during display, that is a very good thing.
After some searches, we found that Nginx has a MogileFS Module. Using this Module, we can directly locate the MogileFS file.
As I am very fascinated by Nginx, it is almost amazing to get such a thing, so I started testing immediately.
My Nginx version is 0.8.35, And the downloaded MogileFS module version is 1.0.2. At the beginning of deployment, it was very difficult because after compiling and installing the module into Nginx, starting Nginx always reports a "Segmentation Fault" error. This error is caused by a null pointer in the program. It seems that the module version is incompatible with the Nginx version. However, according to the description in the module help file, Nginx 0.7 series still cannot be started normally ....
Finally, I downloaded the version 1.0.3 OF THE MogileFS module and finally succeeded in solving the problem. The following is my configuration of the file server for my own needs:
Code
# User nobody;
Worker_processes 4;
Error_log logs/error. log notice;
Worker_rlimit_nofile 10240;
Events {
Use epoll;
Worker_connections 10240;
}
Http {
Include mime. types;
Default_type application/octet-stream;
Server_names_hash_bucket_size 128;
Client_header_buffer_size 32 k;
Large_client_header_buffers 4 32 k;
Client_max_body_size 8 m;
Client_body_buffer_size 128 k;
Proxy_connect_timeout 600;
Proxy_read_timeout 600;
Proxy_send_timeouts 600;
Proxy_buffer_size 16 k;
Proxy_buffers 4 32 k;
Proxy_busy_buffers_size 64 k;
Proxy_temp_file_write_size 64 k;
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;
Gzip_min_length 1 k;
Gzip_buffers 4 16 k;
Gzip_http_version 1.1;
Gzip_comp_level 2;
Gzip_types text/plain application/x-javascript text/css application/xml image/jpg image/jpeg image/gif image/png image/x-xbitmap image/pjpeg application/vnd. ms-excel application/vnd. ms-powerpoint application/msword application/x-shockwave-flash application/octet-stream;
Gzip_vary on;
Tcp_nodelay on;
Server {
Listen 80;
Server_name yourdomain.com;
Location /{
Mogilefs_tracker 192.168.33.2: 6001;
Mogilefs_domain test;
Mogilefs_methods get;
Mogilefs_pass {
Proxy_pass $ mogilefs_path;
Proxy_hide_header Content-Type;
Proxy_buffering off;
}
Expires 1 h;
}
Error_page 500 502 503 x.html;
Location =/50x.html {
Root html;
}
}
}
It is worth noting that in actual use, you should adjust the default_type as needed. The default value is in FireFox, and the image will be downloaded as an unopened file.