page-cache
page-cache copied to clipboard
How to be sure, if the Cached page is loaded
Hey, I have done everything accordingly, html files are also saved in /page-cache/ directory. But how to be sure if my page is loaded from cached files or Database? Please help
Hey, I have done everything accordingly, html files are also saved in /page-cache/ directory. But how to be sure if my page is loaded from cached files or Database? Please help
I even tried changing something in the Description(data of a page), but when I loaded the page, that changed appeared.
If making changes to the HTML (or the data that drives it) immediately shows up on the page, then it's not serving the cached version.
Is there any way? Because I am co
If making changes to the HTML (or the data that drives it) immediately shows up on the page, then it's not serving the cached version.
Is there any other way to check, because if changes, it shows immediately. I also see the cached html files. Can you please help me regarding this. My email: [email protected] or @laptic telegram
I unfortunately don't have the bandwidth to help debug your code.
Make sure you've set up the URL rewriting properly for your Apache/nginx setup 👍
I unfortunately don't have the bandwidth to help debug your code.
Make sure you've set up the URL rewriting properly for your Apache/nginx setup 👍
Here is the NGINX File:
server {
listen 172.XXXXXXX:80;
server_name oyebesmartest.com www.mydomain.com;
error_log /var/log/apache2/domains/mydomain.com.error.log error;
location / {
proxy_pass http://172XXXXXX.183:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/mydomain.com/public_html;
access_log /var/log/apache2/domains/mydomain.com.log combined;
access_log /var/log/apache2/domains/mydomain.com.bytes bytes;
expires max;
try_files $uri $uri/ /page-cache/$uri.html /page-cache/$uri.json /index.php?$query_string;
}
}
location = / {
try_files /page-cache/pc__index__pc.html /index.php?$query_string;
}
location /error/ {
alias /home/admin/web/mydomain.com/document_errors/;
}
location @fallback {
proxy_pass http://1XXXXXX:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.mydomain.conf*;
}
And here is the .htaccess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
Options -Indexes
<Files .htaccess>
order allow,deny
deny from all
</Files>
<Files composer.json>
order allow,deny
deny from all
</Files>
<Files composer.lock>
order allow,deny
deny from all
</Files>
<Files .env>
order allow,deny
deny from all
</Files>
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
RewriteEngine on
RewriteBase /
RewriteRule ^index.php/(.*) /$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
# GZIP COMPRESSION
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# compress HTML
<files *.html>
SetOutputFilter DEFLATE
</files>
# GZIP COMPRESSION
# 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]
RewriteCond %{DOCUMENT_ROOT}/page-cache%{REQUEST_URI}.json -f
RewriteRule . page-cache%{REQUEST_URI}.json [L]
```
Is it correctly done?
I unfortunately don't have the bandwidth to help debug your code.
Make sure you've set up the URL rewriting properly for your Apache/nginx setup 👍
Please reply
@theankitjais Please verify that on the server that the files are being cached to the public/page-cache
folder. If that is occurring on each request that is processed by Laravel, please close this bug and open a Stackoverflow question as to how to setup Ngnix properly in your case to serve those files. You can add the following to your HTML to know when the source was generated:
<!--- Page Generated: {{ now() }} --->
Open source means sharing code so that you don't need to write it. The authors are under no obligation to provide tech support.