Jump to content

Recommended Posts

Posted

Olá pessoal,

Alguém aqui tem o engintron instalado no servidor com as hospedagens dos clientes com um tempo de cache das paginas dinâmicas maior que o padrão de 1 segundo que vem configurado no engintron

-------------------------------------------------------

Eu configurei o meu em 10 minutos para paginas dinâmicas, porem exclui as solicitações POST do cache conforme abaixo, para não cachear as paginas que são modificadas constantemente e não podem ficar em cache como carrinho de compras, área de admin etc..

# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
    set $CACHE_BYPASS_FOR_DYNAMIC 1; # Disables micro-caching
   set $CACHE_BYPASS_FOR_STATIC 1; # Disables static file caching
}   
if ($query_string != "") {
    set $CACHE_BYPASS_FOR_DYNAMIC 1; # Disables micro-caching
   set $CACHE_BYPASS_FOR_STATIC 1; # Disables static file caching
}  

-------------------------------------------------------

já os arquivos estáticos eu configurei para ficar em cache por 1 hora, pois não sofrem atualizações constantemente

braço

 


Posted
Em 24/02/2017 em 12:15, Jean Pinho disse:

Olá pessoal,

Alguém aqui tem o engintron instalado no servidor com as hospedagens dos clientes com um tempo de cache das paginas dinâmicas maior que o padrão de 1 segundo que vem configurado no engintron

-------------------------------------------------------

Eu configurei o meu em 10 minutos para paginas dinâmicas, porem exclui as solicitações POST do cache conforme abaixo, para não cachear as paginas que são modificadas constantemente e não podem ficar em cache como carrinho de compras, área de admin etc..

# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
    set $CACHE_BYPASS_FOR_DYNAMIC 1; # Disables micro-caching
   set $CACHE_BYPASS_FOR_STATIC 1; # Disables static file caching
}   
if ($query_string != "") {
    set $CACHE_BYPASS_FOR_DYNAMIC 1; # Disables micro-caching
   set $CACHE_BYPASS_FOR_STATIC 1; # Disables static file caching
}  

-------------------------------------------------------

já os arquivos estáticos eu configurei para ficar em cache por 1 hora, pois não sofrem atualizações constantemente

braço

 

Em que lugar no Engintron que insere ou altera essa linhas?

Posted
2 minutos atrás, Jean Pinho disse:

Olá,

Na opção: Edit your custom_rules for Nginx

 

A sim, obrigado.

No caso é só colar as linhas no final depois de todas as outras?

Na minha instalação do engintron a configuração padrão que veio do cache é 1min e não 1seg.

Posted
Agora, Cauan disse:

A sim, obrigado.

No caso é só colar as linhas no final depois de todas as outras?

Na minha instalação do engintron a configuração padrão que veio do cache é 1min e não 1seg.

1 min vem como padrão para os arquivos estáticos e 1s para os arquivos dinâmicos. 

A melhor configuração que achei e configurei para mim foi de 10 min para estáticos e dinâmicos

Apague tudo do ( Edit your custom_rules for Nginx ) e cole tudo abaixo a partir do #########

 

 

#####################################################################
# === Place your custom Nginx rules here ===
#
# [comments used below updated for Engintron v1.7.3]
#
# Some examples:
# - HTTP to HTTPS redirect when using CloudFlare
# - Setting up domains with dedicated IPs on the system
# - Any other global rule (redirect or process)
#
#####################################################################

# === FOR USE WITH CLOUDFLARE ===
# For up to date info see the Engintron wiki at: https://github.com/engintron/engintron/wiki
#
# a) If your server has a single shared IP ONLY and you wish to use CloudFlare for any (or all) of your sites
#    you will have to specify this shared IP address below otherwise you'll get errors from CloudFlare.
#    This change will simply tell Nginx to skip DNS resolving and simply forward traffic to the shared IP.
#    Uncomment the following line if all your sites on the shared (main) IP of your server are on CloudFlare:
#
#set $PROXY_DOMAIN_OR_IP "XXX.XXX.XXX.XXX"; # Use your cPanel's shared IP address here
#
# b) If you utilize CloudFlare on a cPanel server with BOTH a shared IP and dedicated IPs for domains, you will
#    have to set the IP ONLY for each such domain at the "WHEN TO SPECIFY A DOMAIN IP" section lower in this file.
#
# c) It is possible to force-redirect all your domains on CloudFlare to HTTPS if you have SSL enabled
#    in CloudFlare's "Crypto" settings page. Make sure you use "Flexible SSL" there so CloudFlare proxies
#    traffic from HTTPS to Nginx's HTTP port (80). This way you can utilize Nginx's caching & performance
#    benefits to the fullest. If you use "Strict SSL" in CloudFlare's "Crypto" settings page, then CloudFlare
#    will proxy all HTTPS requests to your Apache's HTTPS port (443) and therefore you will miss any benefits
#    from Nginx's caching & overall performance features.
#    To redirect to HTTPS, simply remove ONLY the FIRST # character from each line of the following block
#    and make sure you set the domains you DO NOT want to automatically redirect to HTTPS.
#
# # === Protocol redirect handling when using CloudFlare [start] ===
#
# set $redirToSSL "";
# if ($http_cf_visitor ~ '{"scheme":"http"}') {
#     set $redirToSSL "on";
# }
#
# # Set each domain you DO NOT want to automatically redirect to HTTPS when using CloudFlare only below
# # and repeat the process with additional "if" blocks for more domains
#
# if ($host ~ 'domain-to-exclude-from-redirect.com') {
#     set $redirToSSL "off";
# }
# if ($redirToSSL = "on") {
#     return 301 https://$host$request_uri;
# }
#
# # === Protocol redirect handling when using CloudFlare [finish] ===

# === WHEN TO SPECIFY A DOMAIN IP ===
# By default, Nginx will redirect requests to the right domain IP by using DNS resolving.
# However there are cases where you want to specify an IP for use with Nginx:
# - When you use CloudFlare for certain domains only on your server,
#   regardless of whether these domains use the server's shared IP or a dedicated IP.
# - When you are working on a domain which does not yet (DNS) resolve to your server,
#   but you want to access it by modifying your computer's "hosts" file.
#
# To specify the domain IP in such cases, simply enter a domain or subdomain in an "if" block
# (as shown below) and inside that block set the appropriate shared or dedicated IP to point to.
#
# To specify the IP for a domain simply uncomment the following 3 lines and make sure you replace
# example.com with your actual domain or subdomain and also replace XXX.XXX.XXX.XXX with the actual
# IP assigned to that domain. To specify the IP for more domains, simply copy that "if" block
# (per domain) and change accordingly.
#
#if ($host ~ "example.com") {
#    set $PROXY_DOMAIN_OR_IP "XXX.XXX.XXX.XXX";
#}

# === DOMAIN AND URL PATH EXCLUSIONS FROM CACHING ===
# If you wish to exclude certain domains, subdomains or even full URL paths from micro-caching and/or
# static file caching, simply specify them below and use a colon (|) character as a separator.
# Remember that if you specify a "naked" domain name, e.g. mynicedomain.com, every subdomain e.g.
# support.mynicedomain.com will also be excluded from caching. Decide wisely!
# If you wish to disable ONLY micro-caching, then comment the line "set $CACHE_BYPASS_FOR_STATIC".
# If you wish to disable ONLY static file caching, then comment the line "set $CACHE_BYPASS_FOR_DYNAMIC".
#
# Note: Don't include the "http://" portion of a URL.
#
if ($SITE_URI ~* "/signup|/register|/logout|/user|/cadastro|/login|/carrinho|/cart|/pedido|/cliente|/adm|/admin|/administracao|/administrator|/financeiro|/wp-admin|/wp-login.php|/minhaconta|/minha-conta|/conta|/myaccount|/my-account|/account") {
    set $CACHE_BYPASS_FOR_DYNAMIC 1; # Disables micro-caching
   set $CACHE_BYPASS_FOR_STATIC 1; # Disables static file caching
}

# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
    set $CACHE_BYPASS_FOR_DYNAMIC 1; # Disables micro-caching
   set $CACHE_BYPASS_FOR_STATIC 1; # Disables static file caching
}   
if ($query_string != "") {
    set $CACHE_BYPASS_FOR_DYNAMIC 1; # Disables micro-caching
   set $CACHE_BYPASS_FOR_STATIC 1; # Disables static file caching
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Do you agree with our terms?