0

I'm on ubuntu vps running nginx

Running w3 total cache on wordpress.

Everything works fine except for when i enable "rewrite url structure", and it breaks, 404 probably to the minified files.

How to proceed?

Am i missing some package on my vps? what should I install?

Permalink for wordpress work fine though

Note: nginx.conf of site includes custom nginx.file properly which is being written fine by w3tc too, so minify isn't the issue and minify is working fine too, only url rewriting isn't.

Thanks.

closed as off-topic by Mark Kaplun, TheDeadMedic, Howdy_McGee, Nicolai, Pieter Goosen Nov 24 '15 at 17:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1

W3 Total cache generates a nginx.conf file in the root of your blog.

you need to include that file in your nginx configuration file, for W3 Total cache to work properly.

For example if your file is in the /etc/nginx/sites-available/MyWordPress

then edit that file to include your blogs nginx.conf generated by W3 Total Cache in the Server block.

    server {
        listen 80;
        listen [::]:80;

        root /var/www/MyWordPress;
        index index.php index.html index.htm;

       include /var/www/MyWordPress/nginx.conf;
    }

you just need to include the last line.

Update :

nginx.conf generated by W3 Total Cache contains the below rewrite code for Minify :

# BEGIN W3TC Minify core
rewrite ^/wp-content/cache/minify.*/w3tc_rewrite_test$ /wp-content/plugins/w3-total-cache/pub/minify.php?w3tc_rewrite_test=1 last;
set $w3tc_enc "";
if ($http_accept_encoding ~ gzip) {
    set $w3tc_enc .gzip;
}
if (-f $request_filename$w3tc_enc) {
    rewrite (.*) $1$w3tc_enc break;
}
rewrite ^/wp-content/cache/minify/(.+/[X]+\.css)$ /wp-content/plugins/w3-total-cache/pub/minify.php?test_file=$1 last;
rewrite ^/wp-content/cache/minify/(.+\.(css|js))$ /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1 last;
# END W3TC Minify core
  • it's already included properly and is being written by w3 total cache too, being included too, minify is working fine, url rewriting isn't – Nabeel Khan Nov 18 '15 at 17:48
  • nop it wasn't the issue man, it was adding the codes, it wasn't creating the w3tc directory – Nabeel Khan Nov 18 '15 at 22:31
0

The issue was that w3 total cache wasn't creating the w3tc folder in wp-content itself! Don't know why? :/

Anyway, created it, gave it chown to www-data, restarted nginx and voila!

Check the 3rd error on this page for method:

http://nabtron.com/w3-total-cache-fixing-errors/

I wonder if the install guide could be more clear!

Not the answer you're looking for? Browse other questions tagged or ask your own question.