Setting FastCGI in Digitalocean App Platform


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?



Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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.