I have a WordPress site I’m trying to minify with W3 Total Cache. It runs on nginx on Ubuntu 12.04.

  • I am in manual minify mode
  • In the minify settings, I have the Rewrite URL structure option OFF. It doesn’t work either way, but this method needs less nginx config.

When I load the site, it tells WP to load from the following path:

/wp-content/plugins/w3-total-cache/pub/minify.php?file=5fe99/default.include-body.baf22c.js

Likewise, had I turned Rewrite URL structure ON, that path would be:
/wp-content/cache/minify/000000/5fe99/default.include-body.baf22c.js

That file does not exist and it 404’s if you try to go to it.

Looking at that directory, I have:


~/public_html/wp-content/cache/minify/000000/5fe99$ ls -lah
drwxrwxrwx 2 www-data www-data 4.0K Jun 26 08:51 .
drwxrwxrwx 3 www-data www-data 4.0K Jun 26 08:51 ..
-rw-r--r-- 1 www-data www-data 13 Jun 26 08:51 default.include-body.js.id
-rwxrwxrwx 1 www-data www-data 13 Jun 26 08:23 default.include.css.id.old

Other potential solutions:

  • I’ve tried recursively doing a chmod 777 on the entire cache directory, but it just never creates this file, nor does it report an error.
  • I’ve successfully installed and used yui-compressor and Oracle Java, but the file still doesn’t get created with that either. So I know it’s not a JSMin problem.

Contents of local nginx.conf file:

When Rewrite URL structure is OFF, this is all that is requested:


# BEGIN W3TC Minify cache
location ~ /home/MY_HOME_DIR/public_html/wp-content/cache/minify.*.js$ {
types {}
default_type application/x-javascript;
expires modified 31536000s;
add_header Vary "Accept-Encoding";
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
}
location ~ /home/MY_HOME_DIR/public_html/wp-content/cache/minify.*.css$ {
types {}
default_type text/css;
expires modified 31536000s;
add_header Vary "Accept-Encoding";
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
}
location ~ /home/MY_HOME_DIR/public_html/wp-content/cache/minify.*js.gzip$ {
gzip off;
types {}
default_type application/x-javascript;
expires modified 31536000s;
add_header Vary "Accept-Encoding";
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
add_header Content-Encoding gzip;
}
location ~ /home/MY_HOME_DIR/public_html/wp-content/cache/minify.*css.gzip$ {
gzip off;
types {}
default_type text/css;
expires modified 31536000s;
add_header Vary "Accept-Encoding";
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
add_header Content-Encoding gzip;
}
# END W3TC Minify cache

Another error:

Meanwhile, I also get this error:

Recently an error occurred while creating the CSS / JS minify cache: A group configuration for "include-body" was not set.

The plugin author has reported this as a frequent false positive, but that was two years ago. I’m not sure what that means, there’s not much good information on it.

So… has anyone ever gotten file minification to work with W3 Total Cache on nginx? Thanks!

Read more here: WordPress W3 Total Cache Minify - JS and CSS Files Not Created (nginx)


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , , , , , ,

Wordpress related questions and answers: