Quantcast
Channel: WordPress.org Forums » [W3 Total Cache] Support
Viewing all articles
Browse latest Browse all 19291

SysFailure0x5a on "W3 Total Cache - CSS & JS Minify Doesn't Work. The css and js files don't exist"

$
0
0

Yeah, I don't believe I was getting files in that directory with it enabled or disabled. Well at any rate I have this fixed. I pretty much wiped my config and started completely over from scratch. Maybe a syntax error somewhere in the code that wasn't being logged... Not sure. Here is what I have now if anyone else is interested. It may not be perfect, but it works for me.

This config works on my WordPress Multisite 3.6.1 with NGINX 1.4.2 on Ubuntu Server 13.04 with Varnish 3.0.4 in front of everything and W3 Total Cache 0.9.3 with Page Cache, Minify, and all the other nice features enabled. You will need to change 8080 to 80 if you don't have a caching server in front of nginx.

/etc/nginx/nginx.conf

user nginx;
worker_processes 16; # Change this to your CPU/Core count
pid /run/nginx.pid;

events {
        worker_connections 1024;
        multi_accept on;
}

http {

        sendfile on;
        tcp_nopush on;
        keepalive_timeout 120;
        client_max_body_size 512M;
        server_tokens on;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        gzip on;
        gzip_disable "msie6";
        gzip_vary on;
        gzip_comp_level 7;
        gzip_proxied any;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;

}

/etc/nginx/sites-enabled/example.net

server {
        server_name example.net *.example.net;
        listen 8080 default_server;  #remove default_server if not using multisite.
        server_name_in_redirect off; #disable if not using multisite.
        root /var/www/example.net;
        index index.php;
        charset utf-8;

        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;

        #error and log for just this domain
        access_log   /var/log/nginx/examplenet-access.log;
        error_log    /var/log/nginx/examplenet-error.log;

        location ~ \.php$ {
                try_files $uri /index.php;
                include /etc/nginx/fastcgi_params;
                fastcgi_read_timeout 240;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME /var/www/example.net$fastcgi_script_name;

        }

        location / { try_files $uri $uri/ /index.php?$args ;    }
        location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
                access_log off;
                log_not_found off;
                expires max; }

        location = /robots.txt { access_log off; log_not_found off; }
        location ~ /\. { deny  all; access_log off; log_not_found off; }

        rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
        rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

        # START W3 TOTAL CACHE CONFIG
        # BEGIN W3TC Minify cache
        location ~ /wp-content/cache/minify.*\.js$ {
                types {}
                default_type application/x-javascript;
                add_header Vary "Accept-Encoding";
        }
        location ~ /wp-content/cache/minify.*\.css$ {
                types {}
                default_type text/css;
                add_header Vary "Accept-Encoding";
        }

        location ~ /wp-content/cache/minify.*js\.gzip$ {
                gzip off;
                types {}
                default_type application/x-javascript;
                add_header Vary "Accept-Encoding";
                add_header Content-Encoding gzip;
        }

        location ~ /wp-content/cache/minify.*css\.gzip$ {
                gzip off;
                types {}
                default_type text/css;
                add_header Vary "Accept-Encoding";
                add_header Content-Encoding gzip;
        }
        # END W3TC Minify cache
        # BEGIN W3TC Page Cache cache

        location ~ /wp-content/cache/page_enhanced.*html$ {
                add_header Vary "Accept-Encoding, Cookie";
        }

        location ~ /wp-content/cache/page_enhanced.*gzip$ {
                gzip off;
                types {}
                default_type text/html;
                add_header Vary "Accept-Encoding, Cookie";
                add_header Content-Encoding gzip;
        }

        # END W3TC Page Cache cache
        # BEGIN W3TC Browser Cache
        gzip on;
        gzip_types text/css text/x-component application/x-javascript application/javascript
        text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl
        text/xml image/x-icon;

        # END W3TC Browser Cache
        # 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
        # BEGIN W3TC Page Cache core
        set $w3tc_rewrite 1;
        if ($request_method = POST) {
        set $w3tc_rewrite 0;
        }

        if ($query_string != "") {
        set $w3tc_rewrite 0;
        }

        if ($request_uri !~ \/$) {
        set $w3tc_rewrite 0;
        }

        if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle)") {
        set $w3tc_rewrite 0;
        }

        set $w3tc_enc "";
        if ($http_accept_encoding ~ gzip) {
        set $w3tc_enc _gzip;
        }

        if (!-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index.html$w3tc_enc") {
        set $w3tc_rewrite 0;
        }

        if ($w3tc_rewrite = 1) {
        rewrite .* "/wp-content/cache/page_enhanced/$http_host/$request_uri/_index.html$w3tc_enc" last;
        }
        # END W3TC Page Cache core

}

Viewing all articles
Browse latest Browse all 19291

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>