N
N
Nurlan2015-09-24 18:30:47
Nginx
Nurlan, 2015-09-24 18:30:47

Have you set up static caching in RAM correctly?

I decided to unload the HDD a little, I did it like this:
File is given from the subdomain.
content.site.conf:

server {
    listen content.site:80;
    server_name content.site;

     location ~* ^.+\.(jpg|jpeg|gif|png|js|css|swf|docx|doc) {
                proxy_cache static_cache;
                proxy_cache_key "$host$request_uri $cookie_user";
               proxy_cache_valid 200 60m;
               proxy_set_header Host cache.$host;
               proxy_pass http://127.0.0.1;
        }
}

server {
    listen 127.0.0.1:80;
    server_name cache.site;
    location ~* ^.+\.(jpg|jpeg|gif|png|js|css|swf|docx|doc)$ {
        allow 127.0.0.1;
        deny all;
                root /var/www/content;
    }
}

Cache config from nginx.conf
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=static_cache:128m inactive=60m max_size=500m;

Further /etc/fstab:
tmpfs /var/cache/nginx tmpfs noatime,nodiratime,nodev,nosuid,uid=33,gid=33,mode=0700,size=512M 0 0

Well, mount /var/cache/nginx like.
And now, a month later, it became interesting, but did I do everything right? Did using a hodgepodge from the documentation and articles from Google.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question