Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apache not reading updated symlink

I have a symlink at /var/www/domain.example/web/MY_SYMLINK pointing to /var/www/domain.example/web/SOME_FOLDER. This is defined as my document root for the website.

Then I run ln -sfn to change the symlink to something like /var/www/domain.example/web/NEW_FOLDER. So far, so good. If I run ls -a it's possible to see that the change was applied.

If I hit the server at http://domain.example, the website still pointing to the old folder. I know that apache needs to be restarted, so I run service apache2 restart but the change isn't performed. I've tried with apache2 stop/start, reload or graceful. None of them works.

The symlink update is only applied if I go to ISPConfig's control panel and hit Resync.

I wanna be able to perform this from the command line. Anyone know how to do it?

like image 883
Ricardo Vigatti Avatar asked Nov 18 '18 17:11

Ricardo Vigatti


1 Answers

I'm pretty sure that this is related with the fact that you have PHP running as FPM. I've worked with a similar setup and the deployment process was to copy the sources on the server and reseting the symlink that was the document root dir defined in the vhost file. And I had to include a PHP FPM restart at the end of the deployment process, otherwise the server kept serving the old sources.

For restarting the PHP FPM service, the most common ways to do it are:

sudo service php-fpm restart

or

sudo /etc/init.d/php-fpm restart

Or for other ways, you can check the answer from this post.

like image 144
Dan D. Avatar answered Nov 12 '22 03:11

Dan D.