• Resolved jesusinica

    (@jesusinica)


    It seems like the plugin generates a specific configuration for Apache, but not for Nginx. However, in the documentation, it is not mentioned if it is compatible, or not, with Nginx.

    Could you please help me understand whether it is compatible or not, and in the case it is compatible, what steps need to be taken to set it up?

    Thnaks.

Viewing 1 replies (of 1 total)
  • Plugin Author Pegasaas

    (@pegasaas)

    Hi @jesusinica

    Yes, it is compatible with Nginx, but there are a few things to consider as there are some differences between how Pegasaas operates on an Apache server vs Nginx.

    With an Apache server, we will generate a .htaccess file which creates instructions for the web server to fetch cache from a specific location on the file system for the fastest possible Time to First Byte.

    Nginx servers do not use .htaccess, but instead they use their own internal configuration file (.conf) that can only be changed by the server administrator. It is not editable by the plugin. This nginx.conf file is quite powerful, and because there is usually only one of them per website (opposed to the many .htaccess files for an Apache server), provided the nginx.conf is set up to fetch local cache, it can be a much faster solution.

    But that is only if the Nginx web server is manually configured to look for the cache in a particular way. And, again, as Pegasaas does not have access to the nginx.conf file, nor does it know how the web server file system is setup up (so far as paths to our cache is concerned), Pegasaas cannot automatically build this routing into an nginx.conf file.

    So what that means is, that although Nginx can be faster because there’s not as much upfront overhead (because it doesn’t spend a lot of time looking and possibly parsing .htaccess files for subfolder upon subfolder), that the Ngnix server has to use a fallback mechanism to fetch cache. This fallback mechanism involves and requires the WordPress core be engaged. Code in the plugin (that is run via WordPress) handles the check for existing cache and then serves the cache very very early in the page load session. Unfortunately, that can be 200ms – 2500ms longer than the Apache .htaccess method simply due to the load on the server resources at the time, or the memory usage and plugin code that is invoked for your particular WordPress installation.

    Some Nginx platforms, such as Kinsta, use Nginx and often will have a gateway caching system which will cache your pages for you. It’s designed to provide fast caching. Unfortunately, it will not allow for plugins that use dynamic methods such as Pegasaas does to provide optimized HTML. We have to bypass those systems in order to take advantage of PageSpeed scans and optimized HTML.

    So in short, Nginx is fast, but its speed can’t be leveraged for fetching file based cache.

    Another issue with Nginx is that often static resources are explicitly thrown static 404 page when the resource cannot be found. As we often build optimized resources on the fly using the WordPress 404 handler (that invokes the WordPress system), we have to use a secondary mechanism that is not as reliable. This is only used, however, on the Pegasaas Guest API installations however, as our Premium API uses our CDN which doesn’t require the WordPress 404 handler to generate optimized content.

    So to sum up, Nginx can be fast, for a static website, but not so much when a dynamic third-party caching and optimization plugin is involved.

    I hope that answers your questions!

    Kind regards,
    Brandon Devnich
    Pegasaas

Viewing 1 replies (of 1 total)
  • The topic ‘Is it compatible with Nginx?’ is closed to new replies.