Question

Setting FastCGI in Digitalocean App Platform

Posted March 26, 2021 162 views
NginxServer OptimizationCachingDigitalOcean App Platform

Hi,

I’m currently experimenting with a WordPress installation in DO App Platform and I’m running into an issue where I cannot get FastCGI to work at all. I mean Nginx is serving the pages well

I followed several articles I found online, mostly this one which points to a sample configuration file here but from several different tests I did (using curl or third party stress test tools), I can confirm that the content served is not cached at all.

Would anyone be able to provide sample configurations or valid pointers that could potentially help me in setting this up correctly?

Thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

The http response headers should have cache-control settings. The headers are visible if you do curl -v <url>. The app platform will use default settings if it isn’t found. The defaults are to prevent caching on services (as they usually have dynamic content), and static sites default to allowing caching for a while (like a day or so).

There may be a couple of places to set the cache-control headers. The headers could be set in the php code, or by nginx. There are advantages and disadvantages to each approach. Php code can provide greater flexibility to headers if different pages need different settings. It may require some more complex code to be written. Using nginx is usually a simple configuration, which can be good for things like static assets (javascript, css, images) that don’t need to be processed by the php process. A hybrid approach may be needed to get the best results.

  • Hi. Thanks a lot for your response.

    I actually was trying to set these mentioned headers in Nginx directly rather than in PHP but had no luck with that.

    The reason why I said it was not working is because I had already checked using the curl -V command and could not see the additional headers.

    Do you happen to know if anything special needs to be done to the configuration since I’m running the application on App Platform rather than a “traditional” server environment? That is the part that doesn’t seem to be working for me and I can’t find any documentation on it.