Forum Replies Created

Viewing 15 replies - 76 through 90 (of 131 total)
  • Thread Starter Daniel

    (@gabu69)

    Will there be any future async loading releases in the future?

    This is quite important

    Thread Starter Daniel

    (@gabu69)

    Yea just have tried it :S

    Weird thing is i have 2 websites in 2 ubuntu servers

    same install in:

    nginx + hhvm + varnish + cloudflare

    and one works and the other one doesnt purge cache :S so weird

    Thread Starter Daniel

    (@gabu69)

    Yea, but it doesnt actually, I mod a post and its not updating :S

    Do you offer consulting services to check the server and see whats wrong?

    Thread Starter Daniel

    (@gabu69)

    Though was /etc/hosts not having my host in
    127.0.0.1

    added my host and now got this:

    <!DOCTYPE html>
    <html>
      <head>
        <title>200 Purged</title>
      </head>
      <body>
        <h1>Error 200 Purged</h1>
        <p>Purged</p>
        <h3>Guru Meditation:</h3>
        <p>XID: 32770</p>
        <hr>
        <p>Varnish cache server</p>
      </body>
    </html>

    so what’s wrong

    Thread Starter Daniel

    (@gabu69)

    mmmmmmmmmmmmm
    weird:

    <!DOCTYPE html>
    <html>
      <head>
        <title>405 This IP is not allowed to send PURGE requests.</title>
      </head>
      <body>
        <h1>Error 405 This IP is not allowed to send PURGE requests.</h1>
        <p>This IP is not allowed to send PURGE requests.</p>
        <h3>Guru Meditation:</h3>
        <p>XID: 524322</p>
        <hr>
        <p>Varnish cache server</p>
      </body>
    </html>

    why isnt it allowed :S

    Thread Starter Daniel

    (@gabu69)

    Got this one:

    #
    # This is an example VCL file for Varnish.
    #
    # It does not do anything by default, delegating control to the
    # builtin VCL. The builtin VCL is called when there is no explicit
    # return statement.
    #
    # See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
    # and https://varnish-cache.org/trac/wiki/VCLExamples for more examples.
    
    # Update of varnish 4 to work with wordpress
    # Marker to tell the VCL compiler that this VCL has been adapted to the
    # new 4.0 format.
    vcl 4.0;
    
    # Default backend definition. Set this to point to your content server.
    backend default {
        .host = "127.0.0.1";
        .port = "8080";
        .connect_timeout = 600s;
        .first_byte_timeout = 600s;
        .between_bytes_timeout = 600s;
        .max_connections = 800;
    }
    
    # Only allow purging from specific IPs
    acl purge {
        "localhost";
        "127.0.0.1";
    }
    
    # This function is used when a request is send by a HTTP client (Browser)
    sub vcl_recv {
    	# Normalize the header, remove the port (in case you're testing this on various TCP ports)
    	set req.http.Host = regsub(req.http.Host, ":[0-9]+", "");
    
    	# Remove has_js and CloudFlare/Google Analytics __* cookies.
    	set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*", "");
    	# Remove a ";" prefix, if present.
    	set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");
    
    	# Allow purging from ACL
    	if (req.method == "PURGE") {
    		# If not allowed then a error 405 is returned
    		if (!client.ip ~ purge) {
    			return(synth(405, "This IP is not allowed to send PURGE requests."));
    		}
    		# If allowed, do a cache_lookup -> vlc_hit() or vlc_miss()
    		return (purge);
    	}
    
    	# Post requests will not be cached
    	if (req.http.Authorization || req.method == "POST") {
    		return (pass);
    	}
    
    	# --- WordPress specific configuration
    
    	# Did not cache the admin and login pages
    	if (req.url ~ "wp-(login|admin)" || req.url ~ "preview=true") {
    	return (pass);
    	}
    
    	# Remove the "has_js" cookie
    	set req.http.Cookie = regsuball(req.http.Cookie, "has_js=[^;]+(; )?", "");
    
    	# Remove any Google Analytics based cookies
    	set req.http.Cookie = regsuball(req.http.Cookie, "__utm.=[^;]+(; )?", "");
    
    	# Remove the Quant Capital cookies (added by some plugin, all __qca)
    	set req.http.Cookie = regsuball(req.http.Cookie, "__qc.=[^;]+(; )?", "");
    
    	# Remove the wp-settings-1 cookie
    	set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-1=[^;]+(; )?", "");
    
    	# Remove the wp-settings-time-1 cookie
    	set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-time-1=[^;]+(; )?", "");
    
    	# Remove the wp test cookie
    	set req.http.Cookie = regsuball(req.http.Cookie, "wordpress_test_cookie=[^;]+(; )?", "");
    
    	# Are there cookies left with only spaces or that are empty?
    	if (req.http.cookie ~ "^ *$") {
    		    unset req.http.cookie;
    	}
    
    	# Cache the following files extensions
    	if (req.url ~ "\.(css|js|png|gif|jp(e)?g|swf|ico)") {
    		unset req.http.cookie;
    	}
    
    	# Normalize Accept-Encoding header and compression
    	# https://www.varnish-cache.org/docs/3.0/tutorial/vary.html
    	if (req.http.Accept-Encoding) {
    		# Do no compress compressed files...
    		if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {
    			   	unset req.http.Accept-Encoding;
    		} elsif (req.http.Accept-Encoding ~ "gzip") {
    		    	set req.http.Accept-Encoding = "gzip";
    		} elsif (req.http.Accept-Encoding ~ "deflate") {
    		    	set req.http.Accept-Encoding = "deflate";
    		} else {
    			unset req.http.Accept-Encoding;
    		}
    	}
    
    	# Check the cookies for wordpress-specific items
    	if (req.http.Cookie ~ "wordpress_" || req.http.Cookie ~ "comment_") {
    		return (pass);
    	}
    	if (!req.http.cookie) {
    		unset req.http.cookie;
    	}
    
    	# --- End of WordPress specific configuration
    
    	# Did not cache HTTP authentication and HTTP Cookie
    	if (req.http.Authorization || req.http.Cookie) {
    		# Not cacheable by default
    		return (pass);
    	}
    
    	# Cache all others requests
    	return (hash);
    }
    
    sub vcl_pipe {
    	return (pipe);
    }
    
    sub vcl_pass {
    	return (fetch);
    }
    
    # The data on which the hashing will take place
    sub vcl_hash {
     	hash_data(req.url);
     	if (req.http.host) {
         	hash_data(req.http.host);
     	} else {
         	hash_data(server.ip);
     	}
    
    	# If the client supports compression, keep that in a different cache
        	if (req.http.Accept-Encoding) {
            	hash_data(req.http.Accept-Encoding);
    	}
    
    	return (lookup);
    }
    
    # This function is used when a request is sent by our backend (Nginx server)
    sub vcl_backend_response {
    	# Remove some headers we never want to see
    	unset beresp.http.Server;
    	unset beresp.http.X-Powered-By;
    
    	# For static content strip all backend cookies
    	if (bereq.url ~ "\.(css|js|png|gif|jp(e?)g)|swf|ico") {
    		unset beresp.http.cookie;
    	}
    	# Don't store backend
    	if (bereq.url ~ "wp-(login|admin)" || bereq.url ~ "preview=true") {
    		set beresp.uncacheable = true;
    		set beresp.ttl = 30s;
    		return (deliver);
    	}
    
    	# Only allow cookies to be set if we're in admin area
    		if (!(bereq.url ~ "(wp-login|wp-admin|preview=true)")) {
            	unset beresp.http.set-cookie;
    	}
    
    	# don't cache response to posted requests or those with basic auth
    	if ( bereq.method == "POST" || bereq.http.Authorization ) {
            	set beresp.uncacheable = true;
    		set beresp.ttl = 120s;
    		return (deliver);
        	}
    
        	# don't cache search results
    	if ( bereq.url ~ "\?s=" ){
    		set beresp.uncacheable = true;
                    set beresp.ttl = 120s;
                    return (deliver);
    	}
    
    	# only cache status ok
    	if ( beresp.status != 200 ) {
    		set beresp.uncacheable = true;
                    set beresp.ttl = 120s;
                    return (deliver);
    	}
    
    	# A TTL of 2h
    	set beresp.ttl = 2h;
    	# Define the default grace period to serve cached content
    	set beresp.grace = 30s;
    
    	return (deliver);
    }
    
    # The routine when we deliver the HTTP request to the user
    # Last chance to modify headers that are sent to the client
    sub vcl_deliver {
    	if (obj.hits > 0) {
    		set resp.http.X-Cache = "cached";
    	} else {
    		set resp.http.x-Cache = "uncached";
    	}
    
    	# Remove some headers: PHP version
    	unset resp.http.X-Powered-By;
    
    	# Remove some headers: Apache version & OS
    	unset resp.http.Server;
    
    	# Remove some heanders: Varnish
    	unset resp.http.Via;
    	unset resp.http.X-Varnish;
    
    	return (deliver);
    }
    
    sub vcl_init {
     	return (ok);
    }
    
    sub vcl_fini {
     	return (ok);
    }

    But im not sure what couldnt be right, trying to purge sometimes al the cache and it will simply not work

    Thread Starter Daniel

    (@gabu69)

    I see :S

    well lets hope

    also outside topic, if you manage any medium/high traffic blogs

    take 5-10 minutes and read about varnish hector

    https://reviewsignal.com/blog/2014/06/25/40-million-hits-a-day-on-wordpress-using-a-10-vps/
    https://www.garron.me/en/linux/apache-vs-nginx-php-fpm-varnish-apc-wordpress-performance.html

    The PROS on it are huge, more if you combine it a plug in like W3TC which flushed the cache under w3tc rules its amazing what you can acomplish

    Thread Starter Daniel

    (@gabu69)

    I see
    only thing that got me real confused is:

    All was fine (or semi fine) until I installed varnish, once i installed varnish, with 1/3 my peak traffic (which got me 20-30% cpu usage) I got 100% usage on cpu then crash, so thats the weird thing

    thanks tho for the help

    Thread Starter Daniel

    (@gabu69)

    Do you plan to do any mod for this? I mean some way to make it lighter in the future? For medium-high traffic it would be a pain, my site gets about 300k pageviews per day and i expect to have 3-5x by the end of the year and it would be too resource consuming :S

    Thread Starter Daniel

    (@gabu69)

    I had a server without varnish up to yesterday

    Server could handle properly with a 20-30% cpu load up to 15-30 new users per second

    After installing varnish (which should decrease my cpu and ram load by a lot)

    Once website startes getting 5-10 users per second, admin-ajax.php goes crazy high and crashes my server

    how to avoid this?

    I mean everything should be even better but now it just crashes

    Thread Starter Daniel

    (@gabu69)

    any feedback on this?

    Thread Starter Daniel

    (@gabu69)

    Works

    tyty

    Thread Starter Daniel

    (@gabu69)

    You probably also need to change a value on your wp_options table as well. There’s an option_name called blog_charset, set its value to UTF-8. I believe that should fix it.

    It’s set as UTF-8, idk what is wrong then :S

    Thread Starter Daniel

    (@gabu69)

    Good day hector

    I tried changing my dabatabse to UTF-8 (my php characters default was already UTF8) since some tables were not UTF-8 and the error is still there

    https://bit.ly/1sv3B75

    You can notice, 3 out of 6 boxes are displayed, but the other 3 don’t show up and shows that error

    so it might be another thing?

    Thread Starter Daniel

    (@gabu69)

    thanks for the fix

    Why was this not happening before and until this last upgrade?

Viewing 15 replies - 76 through 90 (of 131 total)