2

I have this weird issue that was not happening before.

I am running a Ubuntu Box on Digital Ocean that uses NGINX and PHP-FPM. I also use PHP Deployer to deploy code between Stage and Prod.

Deployer uses symlinks to tell the server where the files are in this case /var/www/mydommain.com/current would be the symlink that points to /var/www/mydomain.com/releases/26.

That is all good and if I do cd /var/www/mydomain.com/current it will change to releases/26. The website however is still pointing to releases/25. I have restarted NGINX and PHP-FPM multiple time without success.

Why is NGINX still pointing to releases/25 when the symlink actually points to releases/26? I can't get it.

In NGINX config for this domain I have root /var/www/mydomain.com/current

AKKAweb
  • 3,795
  • 4
  • 33
  • 64
  • Did you try in a incognito browser with no cache? – Tarun Lalwani Sep 28 '17 at 14:21
  • Yeah. that did not work. It finally fixed itself and I am not sure what did it. Probably a combination of restarts. Also I had to shorten .dep/releases by manually removing old/no longer needed releases from the list. Thanks! – AKKAweb Sep 28 '17 at 14:39

2 Answers2

1

I know this is an 8 months old question, but this might help others:

I ran into the same issue and noticed that if I edit my index file (index.php) of the previous release, the symlink is magically refreshed.

After deploying, I simply run:

touch /path/to/releases/[previous_release_number]/public_html/index.php

...to update the file's modification timestamp.

I ended up including it in my deploy:symlink task like this:

task('deploy:symlink', function () {
    run("cd {{deploy_path}} && ln -sfn {{release_path}}/public_html ./public_html");
    run("touch {{previous_release}}/public_html/index.php");
})->desc('Linking latest version to public_html'); // <= Added this

Hope this helps. Regards, Wouter

opznhaarlems
  • 337
  • 2
  • 9
1

This can be due to $document_root in your Nginx configuration being cached until you do sudo service php5.6-fpm restart.

You can replace $document_root with $realpath_root to avoid the caching.

This website helped me:

https://joshtronic.com/2019/07/29/symlinks-with-nginx-and-php-fpm/

beingalex
  • 2,416
  • 4
  • 32
  • 71