• Resolved gioni

    (@gioni)


    I really like BWM. I decide to use it on all of my sites. But I am confused about using suggested rewrite rules for NGINX. I can’t realize why do you use rule that rise apache to server static files? Why NGINX can’t serve that files directly?
    I tell about this line:
    rewrite ^/cache/minify-b(\d+)-([a-zA-Z0-9-_.]+)\.(css|js)$ /index.php?blog=$1&min_group=$2&min_type=$3 last;

    https://wordpress.org/plugins/bwp-minify/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Khang Minh

    (@oddoneout)

    I take that back, let me recheck this.

    Thread Starter gioni

    (@gioni)

    Still waiting for that 🙂

    Plugin Author Khang Minh

    (@oddoneout)

    According to the current nginx rules:

    set $minify_static "";
    if ($http_cache_control = false) {
        set $minify_static "C";
        set $http_cache_control "";
    }
    if ($http_cache_control !~* no-cache) {
        set $minify_static "C";
    }
    if ($http_if_modified_since = false) {
        set $minify_static "${minify_static}M";
    }
    if (-f $request_filename$zip_ext) {
        set $minify_static "${minify_static}E";
    }
    if ($minify_static = CME) {
        rewrite (.*) $1$zip_ext break;
    }
    rewrite ^/wp-content/plugins/bwp-minify/cache/minify-b(\d+)-([a-zA-Z0-9-_.]+)\.(css|js)$ /index.php?blog=$1&min_group=$2&min_type=$3 last;
    

    We only hit apache when:
    1. A refresh is initiated from user
    2. The cached file is not there (see the -f $request_filename check)

    which means nginx is used to serve static files whenever possible, unless instructed to do otherwise.

    I hope that makes sense.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Serve static files with NGINX only’ is closed to new replies.