Magento Nginx: cache first page request only (no session) for super speedMagento speed & cacheMagento Admin Nginx 404Full Page Cache for constantly updated pages?Full page cache causes checkout POST request to fail, only when logged in!Nginx 502 Error only with full page cache enabled or trying to go to the adminCache Control for magento & Nginx advicemagento enterprise session cache issue500 Internal Server Error nginx/1.12.0 on checkout page after Migration from Apache to NginxNew install on EC2 rewrite issues

Meme-controlled people

How do I change two letters closest to a string and one letter immediately after a string using Notepad++?

Is it good practice to use Linear Least-Squares with SMA?

Tikz picture of two mathematical functions

Most cost effective thermostat setting: consistent temperature vs. lowest temperature possible

Knife as defense against stray dogs

Why Choose Less Effective Armour Types?

Why do tuner card drivers fail to build after kernel update to 4.4.0-143-generic?

The German vowel “a” changes to the English “i”

What exactly is this small puffer fish doing and how did it manage to accomplish such a feat?

How do you talk to someone whose loved one is dying?

Why do newer 737s use two different styles of split winglets?

Is there a hypothetical scenario that would make Earth uninhabitable for humans, but not for (the majority of) other animals?

Print a physical multiplication table

How could an airship be repaired midflight?

How difficult is it to simply disable/disengage the MCAS on Boeing 737 Max 8 & 9 Aircraft?

Counting models satisfying a boolean formula

Aluminum electrolytic or ceramic capacitors for linear regulator input and output?

Why does overlay work only on the first tcolorbox?

Brexit - No Deal Rejection

Did Ender ever learn that he killed Stilson and/or Bonzo?

Why is a white electrical wire connected to 2 black wires?

Does this sum go infinity?

What is a ^ b and (a & b) << 1?



Magento Nginx: cache first page request only (no session) for super speed


Magento speed & cacheMagento Admin Nginx 404Full Page Cache for constantly updated pages?Full page cache causes checkout POST request to fail, only when logged in!Nginx 502 Error only with full page cache enabled or trying to go to the adminCache Control for magento & Nginx advicemagento enterprise session cache issue500 Internal Server Error nginx/1.12.0 on checkout page after Migration from Apache to NginxNew install on EC2 rewrite issues













0















In an effort (and test) to make Magento fly I was playing with microcaching in Magento and came up with the following.



The idea is to: detect a first visit and return visit. A return visit may already have an item in the cart or some session params so we need the dynamic full (slow) Magento. But for first time (never before) visitors we could serve a cached almost static ready to send version?



Question: can we distinguish complete new vs. return visitors in Nginx? And how would we then serve a static file to the complete new visitors (frontpage + categories + cms + products)



General conf



fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=MAGENTO:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;


Server block



 # CACHE TEST
set $skip_cache 0;

# CACHE TEST
if ($http_cookie ~* "frontend_cid|frontend|sid|adminhtml")
set $skip_cache 1;


# CACHE TEST
if ($request_method = POST)
set $skip_cache 1;


# CACHE TEST
if ($query_string != "")
set $skip_cache 1;



## Execute PHP scripts
location ~ .php$
include /etc/nginx/conf.d/headers.conf;
add_header Strict-Transport-Security "max-age=31556926; includeSubDomains; preload";
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE $storecode;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;

# CACHE TEST
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;

fastcgi_cache MAGENTO;
fastcgi_cache_valid 60m;










share|improve this question














bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • hm, varnish is much better for this.

    – MagenX
    Apr 15 '17 at 9:55















0















In an effort (and test) to make Magento fly I was playing with microcaching in Magento and came up with the following.



The idea is to: detect a first visit and return visit. A return visit may already have an item in the cart or some session params so we need the dynamic full (slow) Magento. But for first time (never before) visitors we could serve a cached almost static ready to send version?



Question: can we distinguish complete new vs. return visitors in Nginx? And how would we then serve a static file to the complete new visitors (frontpage + categories + cms + products)



General conf



fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=MAGENTO:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;


Server block



 # CACHE TEST
set $skip_cache 0;

# CACHE TEST
if ($http_cookie ~* "frontend_cid|frontend|sid|adminhtml")
set $skip_cache 1;


# CACHE TEST
if ($request_method = POST)
set $skip_cache 1;


# CACHE TEST
if ($query_string != "")
set $skip_cache 1;



## Execute PHP scripts
location ~ .php$
include /etc/nginx/conf.d/headers.conf;
add_header Strict-Transport-Security "max-age=31556926; includeSubDomains; preload";
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE $storecode;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;

# CACHE TEST
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;

fastcgi_cache MAGENTO;
fastcgi_cache_valid 60m;










share|improve this question














bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • hm, varnish is much better for this.

    – MagenX
    Apr 15 '17 at 9:55













0












0








0








In an effort (and test) to make Magento fly I was playing with microcaching in Magento and came up with the following.



The idea is to: detect a first visit and return visit. A return visit may already have an item in the cart or some session params so we need the dynamic full (slow) Magento. But for first time (never before) visitors we could serve a cached almost static ready to send version?



Question: can we distinguish complete new vs. return visitors in Nginx? And how would we then serve a static file to the complete new visitors (frontpage + categories + cms + products)



General conf



fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=MAGENTO:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;


Server block



 # CACHE TEST
set $skip_cache 0;

# CACHE TEST
if ($http_cookie ~* "frontend_cid|frontend|sid|adminhtml")
set $skip_cache 1;


# CACHE TEST
if ($request_method = POST)
set $skip_cache 1;


# CACHE TEST
if ($query_string != "")
set $skip_cache 1;



## Execute PHP scripts
location ~ .php$
include /etc/nginx/conf.d/headers.conf;
add_header Strict-Transport-Security "max-age=31556926; includeSubDomains; preload";
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE $storecode;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;

# CACHE TEST
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;

fastcgi_cache MAGENTO;
fastcgi_cache_valid 60m;










share|improve this question














In an effort (and test) to make Magento fly I was playing with microcaching in Magento and came up with the following.



The idea is to: detect a first visit and return visit. A return visit may already have an item in the cart or some session params so we need the dynamic full (slow) Magento. But for first time (never before) visitors we could serve a cached almost static ready to send version?



Question: can we distinguish complete new vs. return visitors in Nginx? And how would we then serve a static file to the complete new visitors (frontpage + categories + cms + products)



General conf



fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=MAGENTO:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;


Server block



 # CACHE TEST
set $skip_cache 0;

# CACHE TEST
if ($http_cookie ~* "frontend_cid|frontend|sid|adminhtml")
set $skip_cache 1;


# CACHE TEST
if ($request_method = POST)
set $skip_cache 1;


# CACHE TEST
if ($query_string != "")
set $skip_cache 1;



## Execute PHP scripts
location ~ .php$
include /etc/nginx/conf.d/headers.conf;
add_header Strict-Transport-Security "max-age=31556926; includeSubDomains; preload";
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE $storecode;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;

# CACHE TEST
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;

fastcgi_cache MAGENTO;
fastcgi_cache_valid 60m;







cache full-page-cache nginx server-setup






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 11 '17 at 20:17









snh_nlsnh_nl

2,9031046105




2,9031046105





bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • hm, varnish is much better for this.

    – MagenX
    Apr 15 '17 at 9:55

















  • hm, varnish is much better for this.

    – MagenX
    Apr 15 '17 at 9:55
















hm, varnish is much better for this.

– MagenX
Apr 15 '17 at 9:55





hm, varnish is much better for this.

– MagenX
Apr 15 '17 at 9:55










1 Answer
1






active

oldest

votes


















0














Unfortunately, the answer is "you can't".



Magento 1.x will always set the frontend cookie, and outside application level (Nginx, Varnish, etc.) you can't know whether it is a new visit or not.






share|improve this answer






















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f154326%2fmagento-nginx-cache-first-page-request-only-no-session-for-super-speed%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Unfortunately, the answer is "you can't".



    Magento 1.x will always set the frontend cookie, and outside application level (Nginx, Varnish, etc.) you can't know whether it is a new visit or not.






    share|improve this answer



























      0














      Unfortunately, the answer is "you can't".



      Magento 1.x will always set the frontend cookie, and outside application level (Nginx, Varnish, etc.) you can't know whether it is a new visit or not.






      share|improve this answer

























        0












        0








        0







        Unfortunately, the answer is "you can't".



        Magento 1.x will always set the frontend cookie, and outside application level (Nginx, Varnish, etc.) you can't know whether it is a new visit or not.






        share|improve this answer













        Unfortunately, the answer is "you can't".



        Magento 1.x will always set the frontend cookie, and outside application level (Nginx, Varnish, etc.) you can't know whether it is a new visit or not.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 8 '17 at 19:56









        Danila VershininDanila Vershinin

        41227




        41227



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f154326%2fmagento-nginx-cache-first-page-request-only-no-session-for-super-speed%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

            Magento 2 disable Secret Key on URL's from terminal The Next CEO of Stack OverflowMagento 2 Shortcut/GUI tool to perform commandline tasks for windowsIn menu add configuration linkMagento oAuth : Generating access token and access secretMagento 2 security key issue in Third-Party API redirect URIPublic actions in admin controllersHow to Disable Cache in Custom WidgetURL Key not changing in Magento 2Product URL Key gets deleted when importing custom options - Magento 2Problem with reindex terminalMagento 2 - bin/magento Commands not working in Cpanel Terminal

            Aasi (pallopeli) Navigointivalikko