How to efficiently store and maintain many small images on a website?

On my website, I want to show the user a page with a lot of small photos on it, like thumbnails in Windows.
All images are files ranging in size from 1 KB to over 300 KB, but usually no more than 5 KB.

Currently, all these images are located in a folder on the web server (linux + apache), but I do not think this is the best solution, especially if I need to go to more than one web server and when I will have thousands of them.

So, can I put these files in the database (can I)? Or have a separate file server? Other offers?

+3
source share
2

, :

  • , . , HTTP- .
  • , .
  • , , . . . : , 2 .
  • . .
  • , (, Expires) . , .
  • , cookie-less (sub).
+4

/. ( ). nginx, .

.

worker_processes  1;
events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  300;

    server {
        listen       8080;
        server_name  localhost;

        location /static/ {root static/pictures/;}

        location / { proxy_pass http://127.0.0.1:8081; }
    }
}

8081, //. ( , URL-, '/static', .)

+1

Source: https://habr.com/ru/post/1736216/


All Articles