Skip to content

page cache

Vitor Hugo edited this page Oct 9, 2019 · 1 revision

Configurando o Page-Cache

Nginx:

Atualize o arquivo de configurações (no homestead está em /etc/nginx/sites-available/nome-do-host)

location = / {
    try_files /page-cache/pc__index__pc.html /index.php?$query_string;
}

location / {
    try_files $uri $uri/ /page-cache/$uri.html /index.php?$query_string;
}

Apache:

Abra public/.htaccess e adicione as linhas abaixo antes do bloco nomeado Handle Front Controller:

# Serve Cached Page If Available...
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{DOCUMENT_ROOT}/page-cache/pc__index__pc.html -f
RewriteRule .? page-cache/pc__index__pc.html [L]
RewriteCond %{DOCUMENT_ROOT}/page-cache%{REQUEST_URI}.html -f
RewriteRule . page-cache%{REQUEST_URI}.html [L]

Middleware

Acrescente na rota a middleware turbo

Ex.

Route::get('/', 'FrontendController@index')->name('frontend.index')->middleware('turbo');
Clone this wiki locally