Jump to content

Recommended Posts

Posted

Today there’s a new version of ProCache (4.0.7) available for download in the ProCache support/upgrades board. Here’s what’s new in this version of ProCache:

  • ProCache has been updated throughout for PHP 8.4 support.
  • Upgraded the SCSS compiler to the latest Leafo SCSSPHP 2.0.1. This version requires PHP 8.2, so ProCache also lets you choose from two older versions if you prefer.
  • Upgraded the LESS compiler to the latest Wikimedia LESS 5.4.1. Past versions can also be selected, including Wikimedia 3.0.0 and Leafo LESS 0.5.0.
  • Upgraded the CSS/JS minifier to the latest available version (1.3.75 latest). Because we had customized the CSS/JS minification quite a bit, the older version (1.0 stable) also remains selectable, just in case there’s anything the older version handles that the new one doesn’t yet.
  • LESS, SCSS and Minifier versions can be selected and changed in the ProCache configuration: Setup > ProCache > JS/CSS. Likewise the ProcessProCache module has a new JS/CSS tab for configuring the settings mentioned above.
  • ProCache now logs LESS/SCSS and Minify status and errors to the JS console (when in debug mode or for a logged-in superuser).
  • ProCache now has a proper API reference page available here: https://processwire.com/api/ref/pro-cache/

Because this is a brand new version with several upgraded libraries, it should be considered beta until it's been out a couple of weeks. Thanks for reading and have a great weekend! 

 

 

  • Like 14
  • Thanks 1
Posted

I remember a while back someone posted an nginx config file they got to work with ProCache. I CANNOT find this post and if anyone has a better memory or search skills than me, I would be very greatful for a link.

I've got another project coming up where we'll be building our first public facing website with PW so I'd like to get going on this. Thanks in advance!

Posted
2 hours ago, Jim Bailie said:

I remember a while back someone posted an nginx config file they got to work with ProCache.

Maybe one of these?

 

  • Like 1
Posted

@Jim Bailie This seems like a good question for ChatGPT, at least to get a starting point. I asked it if it could convert .htaccess to nginx and it said:

Quote

Just upload or paste your .htaccess file here, and I’ll convert it into the Nginx equivalent.

So I uploaded this v1 ProCache ruleset from one of my site (I replaced product key with "xxx" for this example): 

# PROCACHE vfd31e36cd7ffdab982312621683b6fee 
RewriteCond %{REQUEST_METHOD} !=POST 
RewriteCond %{QUERY_STRING} !.*=.* 
RewriteCond %{HTTP_COOKIE} !^.*(wire_challenge|wires_challenge).*$ 
RewriteCond %{DOCUMENT_ROOT}/site/assets/ProCache-xxx/$1/index.html -f 
RewriteRule ^(.*) %{DOCUMENT_ROOT}/site/assets/ProCache-xxx/$1/index.html [L] 
# /PROCACHE

And it gave me this:

Quote

This .htaccess block is from ProcessWire’s ProCache module. It serves pre-cached static HTML or XML files if they exist, skipping PHP execution when possible (to improve performance). Here’s the Nginx equivalent configuration for that snippet. You can place this inside your site’s server block (e.g. /etc/nginx/sites-available/example.conf):

# PROCACHE vfd31e36cd7ffdab982312621683b6fee equivalent for Nginx
location / {
    # Skip cache if POST request, query string present, or cookie contains wire_challenge / wires_challenge
    if ($request_method = POST) {
        break;
    }
    if ($query_string != "") {
        break;
    }
    if ($http_cookie ~* "(wire_challenge|wires_challenge)") {
        break;
    }

    # Serve static cached HTML file if it exists
    if (-f $document_root/site/assets/ProCache-xxx/$uri/index.html) {
        rewrite ^(.*)$ /site/assets/ProCache-xxx$uri/index.html break;
    }

    # Default: pass to ProcessWire (index.php)
    try_files $uri $uri/ /index.php?$query_string;
}
# /PROCACHE

I have no idea if it's nginx version works or not, but seems like it might be a potentially good way to convert something like this. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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