I need the best nginx configuration please

Antonio Jerez Guillén pobreiluso at gmail.com
Fri Apr 6 10:48:18 UTC 2012


Hi there!

I guess, that your problem could be O.S. related and not Nginx related.
I meant, probably, you are using more files per directory than your O.S.
could support, in many cases, this limit is about 32.000 files per
directory, but it may depends of your filesystem.
take a look to the link below:
http://stackoverflow.com/questions/466521/how-many-files-in-a-directory-is-too-many

In order to solve this issue, you must add a two or three directory levels
structure. For example:

I guess your current directory structure is something like:
/img/abcdefghijklmnñopqrstuvwxyz.jpg

And you must try something like:
/img/*ab/cd/ef/*abcdefghijklmnñopqrstuvwxyz.jpg
Or also works for somebody, to add a modulus function to the directories,
for example:

/img/*01/02/*abcdefghijklmnñopqrstuvwxyz.jpg

Hope it helps.


El 6 de abril de 2012 10:06, Volodymyr Kostyrko <c.kworr at gmail.com>escribió:

>
>
> MOHAMMED A. wrote:
>
>> Hello,
>>
>> Please, I need the best nginx configuration for my servers
>> My servers for images hosting
>> In any server, From 2 to 5 million images
>> The problem is that images do not appear quickly, a long time, Slow
>> Please help me in this, I need the best nginx configuration
>>
>> Thanks.
>>
>> The configuration now
>>
>> user  nobody;
>> # no need for more workers in the proxy mode
>> worker_processes  2;
>> error_log  /var/log/nginx/error.log info;
>> worker_rlimit_nofile 20480;
>> events {
>>  worker_connections 5120; # increase for busier servers
>>  use epoll; # you should use epoll here for Linux kernels 2.6.x
>> }
>> http {
>>  upload_progress_header id;
>>  upload_progress uploads 5m;
>>  server_name_in_redirect off;
>>  server_names_hash_max_size 10240;
>>  server_names_hash_bucket_size 1024;
>>  include    mime.types;
>>  default_type  application/octet-stream;
>>  server_tokens off;
>>  sendfile on;
>>  tcp_nopush on;
>>  tcp_nodelay on;
>>  keepalive_timeout  5;
>>  gzip on;
>>  gzip_vary on;
>>  gzip_disable "MSIE [1-6]\.";
>>  gzip_proxied any;
>>  gzip_http_version 1.1;
>>  gzip_min_length  1000;
>>  gzip_comp_level  6;
>>  gzip_buffers  16 8k;
>> # You can remove image/png image/x-icon image/gif image/jpeg if you have
>> slow CPU
>>  gzip_types    text/plain text/xml text/css application/x-javascript
>> application/xml image/png image/x-icon image/gif image/jpeg
>> application/xml+rss text/javascript application/atom+xml;
>>  ignore_invalid_headers on;
>>  client_header_timeout  360m;
>>  client_body_timeout 360m;
>>  send_timeout     360m;
>>  reset_timedout_connection on;
>>  connection_pool_size  256;
>>  client_header_buffer_size 256k;
>>  large_client_header_buffers 4 256k;
>>  client_max_body_size 2048M;
>>  client_body_buffer_size 1024k;
>>  request_pool_size  32k;
>>  output_buffers   4 32k;
>>  postpone_output  1460;
>>  proxy_temp_path  /home/matarNginx/nginx_proxy/;
>>  client_body_in_file_only on;
>>  log_format bytes_log "$msec $bytes_sent .";
>>
>
> Everything looks good. Some options point to default values and can be
> omitted.
>
>   include "/etc/nginx/vhosts/*";
>> }
>>
>
> This line includes all files under listed directory. Whole your config is
> only about nginx configuration and lack particular site configuration.
> Maybe posting those would give anyone better clue on whats going on with
> your system.
>
> --
> Sphinx of black quartz judge my vow.
>
>
> ______________________________**_________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/**mailman/listinfo/nginx<http://mailman.nginx.org/mailman/listinfo/nginx>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120406/635b3433/attachment.html>


More information about the nginx mailing list