triosolle
1 week ago

Nginx fast-cgi invalid cache problems after deployment

Posted 1 week ago by triosolle

Every deployment sets the document root of the application to a new path via symlinks. We had some caching problems, like old releases still being served instead of new ones. Or cached views not updating.

The documentation states that fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; should be used instead of fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;. Our problems could be fixed by either using $realpath_root or clearing all caches after deploying.

Our dev-ops guy thinks that$realpath_root is really hacky and does not want to implement that change, but we want to be as close as possible to the official documentation. Can somebody tell me, why exactly $realpath_root should be used? And is this configuration necessary 100% of the time or can it be ignored if we want to?

Please sign in or create an account to participate in this conversation.