Support » Plugin: Super Page Cache for Cloudflare » How to use on Nginx

  • Hi,

    I have a WP business account that uses nginx so no .htaccess file. Getting error: Error: The .htaccess file (/wordpress/core/5.6/.htaccess) could not be edited. Check if the file has write permissions.

    Test Errors:
    Page caching seems not working for both dynamic and static pages.

    Error on dynamic page (https://tapestryfinecarpetcleaning.ca): Seem that your website is not behind Cloudflare. If you have recently enabled the cache or it is your first test, wait about 30 seconds and try again because the changes take a few seconds for Cloudflare to propagate them on the web. If the error persists, request support for a detailed check.

    Error on static resource (https://tapestryfinecarpetcleaning.ca/wp-content/plugins/wp-cloudflare-page-cache/assets/testcache.html): Seem that your website is not behind Cloudflare. If you have recently enabled the cache or it is your first test, wait about 30 seconds and try again because the changes take a few seconds for Cloudflare to propagate them on the web. If the error persists, request support for a detailed check.

    Please check if the page caching is working by yourself by surfing the website in incognito mode ’cause sometimes Cloudflare bypass the cache for cURL requests. Reload a page two or three times. If you see the response header cf-cache-status: HIT, the page caching is working well.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter nightfallsonhoboken

    (@nightfallsonhoboken)

    After reading more, it looks like this plugin is only compatible if you modify the Nginx configuration file?

    Plugin Contributor Saumya Majumder

    (@isaumya)

    Hi @nightfallsonhoboken,
    The plugin works our of the box for all servers. Be it nginx, apache, lightspeed etc. If you look inside the plugin settings (screenshot: https://i.imgur.com/xFqU5jk.png) and go to the instruction page you will see that it is only asking you to add 3 Nginx rules in your nginx.conf file:

    location ~* \.(xml)$ { add_header Cache-Control "no-cache, no-store, must-revalidate, max-age=0"; expires -1; }
    location /robots.txt { add_header Cache-Control "no-cache, no-store, must-revalidate, max-age=0"; expires -1; }
    location = /wp-content/wp-cloudflare-super-page-cache/example.com/debug.log { access_log off; deny all }
    

    If you look closely, the first & second rule is to ensure that the sitemap XML files and robots.txt files don’t get cached by Cloudflare cache. The third rule is to ensure that if you enable the Log Mode, the log generated by the plugin cannot be accessed via HTTP, so the outside world can’t see it.

    That’s it. Nothing more configuration to add.

    Now coming to caching your website, as I can see you are not using this plugin and instead of using CF APO which is basically bypassing your webpages and not being served from cache. Screenshot: https://i.imgur.com/RK2sKpe.png

    If you choose the enable this plugin on your site and still facing any issues, let us know will be more than happy to look into it.

    Thread Starter nightfallsonhoboken

    (@nightfallsonhoboken)

    Thanks Saumya, yes I tried CF APO to see how it works. No actual speed benefit. I would like to use your plugin but I do not how to add the code. I have never worked with Nginx.

    Plugin Contributor Saumya Majumder

    (@isaumya)

    Hi @nightfallsonhoboken,
    Are you using a self-hosted server or it is hosted via some hosting company? If it is behind some hosting company let them know the configs you want to add and they will do it for you.

    Thread Starter nightfallsonhoboken

    (@nightfallsonhoboken)

    It’s hosted with WordPress, but I have FTP and database access. I will ask them. They are pretty helpful. If the code is added, and I stop using the plugin, does the code have to be removed?

    Plugin Contributor Saumya Majumder

    (@isaumya)

    Hi @nightfallsonhoboken,
    I don’t understand what code you want to remove. You just ask your host to add the 3 lines of nginx config asking you to add in the instruction inside plugin settings (screenshot: https://i.imgur.com/xFqU5jk.png).

    Also, make sure you remove the official Cloudflare plugin from your site and disable APO in your Cloudflare dashboard.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to use on Nginx’ is closed to new replies.