SatelliteWP/rocket-nginx

CentminMod: 404 on all pages except frontpage due to incompatible folder structure? (permalinks)

Shirkit opened this issue · 3 comments

Hello, I'm facing unexpected issue while trying to use Rocket-NGINX

After reading the installation instructions, I've tried implementing on my website but it only loads the homepage. The other pages returns 404.

After investigating if the cache was being generated, for the homepage everything works and the files are there, it does not works for other pages.

When I disable Rocket-NGINX the cache is created on the first time I load a page with WP Rocket, but the folder structure seems to be a little off from what I've expected. For instance, for the page with url /loja/ the created strcture is located at /wp-content/cache/wp-rocket/temp.orquidariobahia.com.br/loja/#q=%2floja%2f/index-https.html and I think that's the reason why it's failing to find the files.

Rocket-NGINX debug is enabled for now, and you can see for the homepage
x-rocket-nginx-file: /home/nginx/domains/temp.orquidariobahia.com.br/public/wp-content/cache/wp-rocket/temp.orquidariobahia.com.br////index-https.html
x-rocket-nginx-reason: /wp-content/cache/wp-rocket/temp.orquidariobahia.com.br////index-https.html
x-rocket-nginx-serving-static: HIT

But for any other page, it does not output the expected headers at all.

I'm using the default configuration for Rocket-NGINX. You can check the website live at here

If needed I can place nginx config files, but they are set mostly to default on Centmin's side (except I disabled only Cache Enabler relevant part) and added Rocket-NGINX to it.

Versions
What version of Nginx are you using ? 1.21.6
What version of Rocket-Nginx are you using ? 3.0
What version of WP Rocket are you using ? 3.11.5
Are you using Nginx as a reverse proxy (with Apache for instance) ? No
I'm using CentminMod on latest Beta branch on default configurations (except Cache Enabler specifics is disabled)
Permalink structure is enabled on "Post Name"


I'm thinking it's due to some missconfiguration on NGINX on my part? But then it should output something on the headers. Maybe it has something to do with the permalink structure? As seen on the created cache folders, something seems off.

Thank you

Technically, Rocket-Nginx checks if the cached HTML file exists. If it does, it serves it. Otherwise, it does nothing.

The only reason I see to view 404 pages from Rocket-Nginx is if WP Rocket created an HTML file containing your 404 page. If that is the case, the bug should be reported to WP Rocket. That being said, I doubt this is what happened.

You should be able to see the debug headers on these 404 pages. Do you get anything from Rocket-Nginx?

Edit: I read again and saw the folder created by WP Rocket. There is definitely a problem with your configuration. There should be a direct correlation between what you see in the URL and how the folders are created on disk. If you can fix that, you should be ok!

Yeah I figured it out it should be a configuration issue, but I cannot pinpoint it down.
I have disabled rocket-nginx until I figure out exactly what's wrong, but I'm sure it's coming down from a interaction combination of CentminMod optmizations and WP Rocket.

Anyways, if I do find a solution I'll gladly report it back here.

People described in the link below some possible solutions to solve the issue with permalinks.

Changing the to try_files $uri $uri/ /index.php?$args; creates the cache folder in the correct location, one problem solved.

But if rocket-nginx still does not find a cached file, everything fails. After failing to find the file, it still does not redirect to normal Wordpress to handle thus spits out 404 page, without any headers even with debug on. Probably getting overriden somewhere.

https://community.centminmod.com/threads/wp-rocket-installation-on-nginx.16688/

Some further look into NGINX configs will be necessary, at least now WP Rocket is serving generated cache correctly.