DEV Community

Ibrar Hussain
Ibrar Hussain

Posted on

How to fix Nginx symlink caching issue

Let's assume that you have a Laravel application running through nginx and pointing to the current folder which is symlink of the latest release folder you have.

root /home/foo/domain.com.au/current/public;
Enter fullscreen mode Exit fullscreen mode

If you update your symlink for the current to a new release, your application will still be point to the older release.

To resolve this, add the following lines to your nginx file after include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
Enter fullscreen mode Exit fullscreen mode

and it should look this:

nginx symlink issue fix

Now, if you change/update the symlink it should be working properly, and point to the correct release folder.

Oldest comments (0)