SatelliteWP / rocket-nginx

Rocket-Nginx is a Nginx configuration that makes WP-Rocket even faster by serving static pages directly without loading WordPress or PHP.
MIT License
579 stars 129 forks source link

what is this config really do? #176

Closed cypa closed 2 years ago

cypa commented 2 years ago

Could you please explain what is very special in this config generator? I found no special features compared to usual WP nginx config and found numerous fancy variables, some very confusing like this

# Is GZIP accepted by client ?
if ($http_accept_encoding ~ gzip) {
        set $rocket_encryption "_gzip";
}

gzip do no encryption AFAIK

cypa commented 2 years ago

Could we replace the whole bunch of "if" statements with a single "try_files" directive?! As Igor Sysoev suggests.

maximejobin commented 2 years ago

This configuration is used to avoid calling PHP and serve files directly.

The code you are referring to is to serve the gzip file directly if it exists.

gzip do no encryption AFAIK

That is true. It zips the file before sending it. But where does it say it encrypts anything ?

With all due respect, this is an advanced configuration and I'm not sure you are the right person to use it (based on your questions). Despite the fact it is almost a "plug'n play" configuration, you have to understand how caching works.

Your questions make me assume you are not the right fit for such configuration and maybe should use a more generic approach:

https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/

I do not intend to insult you or anything. Caching can be awesome... or bring a lot of problems. It really depends on how good you understand it and have the ability to debug it.

cypa commented 2 years ago

Well, excuse my if it was direct and tough and have my best wishes!

But we've found no difference in our site response with and without Rocket-Nginx ... hence my question above. Then I'd like to see features of the Rochet-Nginx config separated carefully, so one can see and choose the very feature one needs or not.

cypa commented 2 years ago

as I can see this is the clause to avoid php call!?

# If the bypass token is still on, rewrite according to the file linked to the request
if ($rocket_bypass = 1) {
        rewrite .* "$rocket_url" last;
}