On A, I have scripted my server installation to install PHP (8.4.21), MySQL and Apache
On B, I have scripted my server installation to install PHP (8.4.21), MySQL and Nginx
For B, when re-running the script on a fresh machine recently, /var/run/php-fpm.sock is now missing and causing the Laravel site not to load in the browser
The script of A remains problem free
Has anyone faced the same issue and found a solution? I suspect it is in Nginx
Then enable it so it starts automatically on boot:
sudo systemctl enable php-fpm
This is assuming the service is named php-fpm in your system, which it probably is if the socket file was named php-fpm.sock before you rebooted. Often the service is versioned instead, e.g. php8.4-fpm.
You need php-fpm to run a Laravel app – or any PHP app for that matter – through Nginx. There are alternatives, but php-fpm is by far the most popular choice.
As I mentioned, the service may have a different name, such as php8.4-fpm. You can look for it:
systemctl list-unit-files | grep php
If you updated PHP and accidentally uninstalled php-fpm, you need to reinstall it.