Sunday, February 12, 2017

apache + nginx wordpress dynamic cache

nginx.conf http section

    proxy_cache_path /var/cache/nginx levels=2 keys_zone=cache:10m inactive=60m max_size=1024m;
    proxy_cache_key "$host$request_uri $cookie_user";
    proxy_temp_path  /var/cache/nginx/temp;
    proxy_ignore_headers Expires Cache-Control;
    proxy_cache_use_stale error timeout invalid_header http_502;
    proxy_cache_valid any 1d;

location config:

    location / {
        proxy_pass      http://127.0.0.1:8080;
        proxy_pass_header "X-Accel-Redirect";
        proxy_pass_header "X-Accel-Expires";
        proxy_cache cache;

        proxy_cache_key $scheme$host$request_uri$request_method;
        proxy_pass_header Set-Cookie;
        proxy_pass_header Cookie;
        proxy_ignore_headers Cache-Control Expires Set-Cookie;
        proxy_cache_valid 200 301 302 10m;
        access_log /var/log/nginx/example.com-access-cache.log cache;

        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz
            root           /var/www/html/example.com/public_html;
            access_log     /var/log/nginx/example.com-access.log;
            error_log     /var/log/nginx/example.com-error.log;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location ~ ^/(wp-admin|wp-login\.php) {
        proxy_pass      http://127.0.0.1:8080;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz
            root           /var/www/html/example.com/public_html;
            access_log     /var/log/nginx/example.com-access.log;
            error_log     /var/log/nginx/example.com-error.log;
            expires        max;
            try_files      $uri @fallback;
        }
    }

No comments:

Post a Comment

grub2-install: error: disk `mduuid/e54081d398c6d57b4d67436f6d032162' not found

After raid 1 disk replacement faced with this issue # grub2-install /dev/sdb Installing for i386-pc platform. grub2-install: error: disk `md...