Webserver randomly serves different vhosts
After hours of debugging this issue we've finally been able to trace it to the cause. It appears the cause isn't nginx
, but PHP-fpm. We're running php5-fpm
version 5.5.9-1ubuntu4.14
. It appears that when forking new workers, something sometimes goes wrong and the workers run (part?) of the code of different workers.
Our solution was to copy /etc/php5/fpm/php5-fpm.conf
to different copies with their own pool.d
folders, then to copy /etc/init.d/php5-fpm
to launch with the new config file (also creating files in /etc/init/
). This means we now have a php5-fpm
process manager per pool. Having seperate chroots and sockets don't appear to keep things separate enough.
I am facing the same issue but on Debian with Apache2.4.25 and PHP7.1-FPM. Here is a way to separate processes https://ma.ttias.be/a-better-way-to-run-php-fpm/
For those like me who might find this solution too heavy for small websites, add php_admin_value[opcache.revalidate_freq] = 0
at the end of the php-fpm pool configuration file. However, that may have a serious impact on performances...
Here is the official bug report: https://bugs.php.net/bug.php?id=67141