Coder Social home page Coder Social logo

genaker / fastfpc Goto Github PK

View Code? Open in Web Editor NEW
45.0 6.0 9.0 52 KB

Magento 2 improved FPC and Varnish replacement was used for Magento SaaS solution when you need high performace and scaling. No more outdated Adobes official Varnish approach is requred

PHP 100.00%
magento adobe varnish varnish-cache ecommerce

fastfpc's People

Contributors

genaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fastfpc's Issues

Magento 2.4.6 issues, blank page and deploy error

Doesn't seem work on Magento 2.4.6 on a cloudlinux instance with php8.1, unfortunately. Upon running "bin/magento fpc:deploy" it gives the following error:

`PHP Warning:  Module "igbinary" is already loaded in Unknown on line 0
grep -r "FPC.php" /var/www/vhosts/mydomain.com/httpdocs/pub/index.php || sed -i '2 i include "/var/www/vhosts/mydomain.com/httpdocs/vendor/mage/fpc/Mage/FPC/FPC.php";' /var/www/vhosts/mydomain.com/httpdocs/pub/index.php
array(1) {
  [0]=>
  string(94) "include "/var/www/vhosts/mydomain.com/httpdocs/vendor/mage/fpc/src/Mage/FPC.php";"
}

There is an error in /var/www/vhosts/mydomain.com/httpdocs/vendor/symfony/console/Command/Command.php at line: 301
Return value of "Mage\FPC\Console\Deploy\Interceptor::execute()" must be of the type int, "null" returned.#0 /var/www/vhosts/mydomain.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run()
#1 /var/www/vhosts/mydomain.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(138): Mage\FPC\Console\Deploy\Interceptor->___callParent()
#2 /var/www/vhosts/mydomain.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(153): Mage\FPC\Console\Deploy\Interceptor->Magento\Framework\Interception\{closure}()
#3 /var/www/vhosts/mydomain.com/httpdocs/generated/code/Mage/FPC/Console/Deploy/Interceptor.php(23): Mage\FPC\Console\Deploy\Interceptor->___callPlugins()
#4 /var/www/vhosts/mydomain.com/httpdocs/vendor/symfony/console/Application.php(1040): Mage\FPC\Console\Deploy\Interceptor->run()
#5 /var/www/vhosts/mydomain.com/httpdocs/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#6 /var/www/vhosts/mydomain.com/httpdocs/vendor/magento/framework/Console/Cli.php(116): Symfony\Component\Console\Application->doRun()
#7 /var/www/vhosts/mydomain.com/httpdocs/vendor/symfony/console/Application.php(171): Magento\Framework\Console\Cli->doRun()
#8 /var/www/vhosts/mydomain.com/httpdocs/bin/magento(23): Symfony\Component\Console\Application->run()
#9 {main}`

Tried different approaches wit app folder and composer. Adding to index or bootstrap or ngingx. Just a blank page after that and above error. Any idea what this could be? PHPRedis is installed.

Remove all marketing get parameters to minimize the cache objects

Marketing query parameter like gclid should not be respected in cache-key.

Varnish equivalent:

set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=[-_A-z0-9+()%.]+&?", "");
set req.url = regsub(req.url, "[?|&]+$", "");

Query String Sort

Query String Sort increases cache-hit rates by first sorting query strings into a consistent order before checking the Rdis cache.

By default, magento cache treats resources as distinct if their URL query strings are in a different order. For instance, these resources are cached separately:

/48088296?title=0&byline=0&portrait=0&color=51a516
/48088296?byline=0&color=51a516&portrait=0&title=0
Query String Sort changes this behavior. If two query strings exist with the same name, the URL is sorted by the parameter value. For example:

/example/file?word=alpha&word=beta and /example/file?word=beta&word=alpha

would be sorted to:

/example/file?word=alpha&word=beta

So​​lution :

$dataArray = $_GET;
$dataArray = array_filter($dataArray, 'strlen');
ksort($dataArray);

God Mod

Always return from cache! Revers cache from the local file system.

Magento is stupid and gzips headers.

Magento stores cache GZIPED. However only content must be Gzipped and content returned to the Nginx with added header

"You must add header("Content-Encoding: gzip"); to your php gzipped response."

Fallback for uncached page

server {
listen 80 default_server;

location / {
    
    if ($uri ~ "^/$") {
        rewrite / /404;
    }
    
    proxy_intercept_errors on;
    proxy_pass http://codes:80;
    
    error_page 403 404 503 = @outage;
    
    error_page 400 401 500 = @miss-php;
}

location @outage {
    rewrite ^ /200;
    proxy_pass http://codes:80;
}

location @miss-php {
    fastcgi_pass codes-php:9000;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME /var/www/html/index.php;
    fastcgi_param DOCUMENT_ROOT /var/www/html;
    internal;
}

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.