Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter silaslin

    (@silaslin)

    I’ve found some bugs and fixed.

    
    (wppcache) {
    
            header Vary Accept-Encoding
    
            @is-gzip {
                    file
                    path *.html_gz *.html_mobile_gz *.html_amp_gz *.html_mobile_amp_gz
            }
    
            header @is-gzip {
                Content-Type text/html
                Content-Encoding gzip
            }
    
            @no-gzip {
                    file
                    not path *.html_gz *.html_mobile_gz *.html_amp_gz *.html_mobile_amp_gz
            }
    
            @mobile header_regexp User-Agent Mobile|Android|Kindle|BlackBerry|Opera\sMini|Opera\sMini
            @amp path /amp/*
            @gzip header_regexp Accept-Encoding gzip        
            @mobile-gzip {
                    header_regexp User-Agent Mobile|Android|Kindle|BlackBerry|Opera\sMini|Opera\sMini
                    header_regexp Accept-Encoding gzip
            }
            @amp-gzip {
                    path /amp/*
                    header_regexp Accept-Encoding gzip
            }
            @mobile-amp-gzip {
                    header_regexp User-Agent Mobile|Android|Kindle|BlackBerry|Opera\sMini|Opera\sMini
                    path /amp/*
                    header_regexp Accept-Encoding gzip
            }       
            @else {
                    not header_regexp User-Agent Mobile|Android|Kindle|BlackBerry|Opera\sMini|Opera\sMini
                    not path /amp/*
                    not header_regexp Accept-Encoding gzip
            }
    
            @cache {
                    not header_regexp Cookie "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in"
                    not path_regexp "(/wp-json/|/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(index)?.xml|[a-z0-9-]+-sitemap([0-9]+)?.xml)"
                    not method POST
                    not expression {query} != ''
        }
    
        route @cache {
                    handle @mobile {
                            try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_mobile
                    }
                    handle @amp {
                            try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_amp
                    }
                    handle @gzip {
                            try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_gz
                    }
                    handle @mobile-gzip {
                            try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_mobile_gz
                    }
                    handle @amp-gzip {
                            try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_amp_gz
                    }
                    handle @mobile-amp-gzip {
                            try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_mobile_amp_gz          
                    }
                    handle @else {
                            try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?{query}
                    }
        }
    }
    
    domain.com {
        # Change the path here according to your setup
    	root * /var/www/domain.com
    	file_server
    
       # Change the path here according to your server
        php_fastcgi unix//run/php/php7.4-fpm.sock
    
        import wppcache
        encode @no-gzip zstd gzip    
    }
    
    • This reply was modified 3 years, 10 months ago by silaslin.
    Thread Starter silaslin

    (@silaslin)

    This is the last modified code

    
    (wppcache) {
    
    	header Vary Accept-Encoding
    
    	@is-gzip {
    		file
    		path *.html_gz *.html_mobile_gz *.html_amp_gz *.html_mobile_amp_gz
    	}
    
    	header @is-gzip {
    	    Content-Type text/html
    	    Content-Encoding gzip
    	}
    
    	@no-gzip {
    		file
    		not path *.html_gz *.html_mobile_gz *.html_amp_gz *.html_mobile_amp_gz
    	}
    
    	@mobile header_regexp User-Agent Mobile|Android|Kindle|BlackBerry|Opera\sMini|Opera\sMini
    	@amp path /amp/*
    	@gzip header_regexp Accept-Encoding gzip
    	@mobile-amp {
    		header_regexp User-Agent Mobile|Android|Kindle|BlackBerry|Opera\sMini|Opera\sMini
    		path /amp/*
    	}
    	@mobile-gzip {
    		header_regexp User-Agent Mobile|Android|Kindle|BlackBerry|Opera\sMini|Opera\sMini
    		header_regexp Accept-Encoding gzip
    	}
    	@amp-gzip {
    		path /amp/*
    		header_regexp Accept-Encoding gzip
    	}
    	@mobile-amp-gzip {
    		header_regexp User-Agent Mobile|Android|Kindle|BlackBerry|Opera\sMini|Opera\sMini
    		path /amp/*
    		header_regexp Accept-Encoding gzip
    	}	
    	@else {
    		not header_regexp User-Agent Mobile|Android|Kindle|BlackBerry|Opera\sMini|Opera\sMini
    		not path /amp/*
    		not header_regexp Accept-Encoding gzip
    	}
    
    	@cache {
    		not header_regexp Cookie "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in"
    		not path_regexp "(/wp-json/|/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(index)?.xml|[a-z0-9-]+-sitemap([0-9]+)?.xml)"
    		not method POST
    		not expression {query} != ''
        }
    
        route @cache {
    		handle @mobile {
    			try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_mobile
    		}
    		handle @amp {
    			try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_amp
    		}
    		handle @gzip {
    			try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_gzip
    		}
    		handle @mobile-amp {
    			try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_mobile_amp
    		}
    		handle @mobile-gzip {
    			try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_mobile_gzip
    		}
    		handle @amp-gzip {
    			try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_amp_gzip
    		}
    		handle @mobile-amp-gzip {
    			try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?_mobile_amp_gzip		
    		}
    		handle @else {
    			try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?{query}
    		}
        }
    }
    
    domain.com {
        # Change the path here according to your setup
    	root * /var/www/domain.com
    	file_server
    
       # Change the path here according to your server
        php_fastcgi unix//run/php/php7.4-fpm.sock
    
        import wppcache
        encode @no-gzip zstd gzip    
    }
    
    Thread Starter silaslin

    (@silaslin)

    Thank you!

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