php7.2-fpm apache2 will reveal many guides to configure apache.
NOTE ---I do not claim this to be the proper or most secure settings.
The issue of site security is complex and constantly evolving. It is up to you to keep up to date on the best security practices.
This is the method I successfully used the set up in a development environment.
This assumes default Ubuntu 18.04 LAMP server settings with php7.2 installed.
Method is simalar for release standard php or php7.3 and php7.4(with ppa REPOs configured)
If you do not have one first create a php info page.
echo '<?php phpinfo() ?>' | sudo tee /var/www/html/phpinfo.php
Check page in browser via local network or gui if installed on server.
"server ip or domain"/phpinfo.php
The line 'Server API' will confirm default 'Apache 2.0 Handler'
In a terminal navigate to path /etc/apache2/
Check that you have the
php7.2-fpm configuration available in
If it is not available it may be installed via:
sudo apt install php7.2-fpm
sudo a2enconf php7.2-fpm
This creates a link of the actual file
/etc/apache/conf-available/php7.2-fpm.conf and places it in
/etc/apache2/conf-enabled directory. By default ubuntu apache2 configuration includes all *.conf files from
/etc/apache2/*-enabled directorys into the
Now you will need to enable the
sudo a2enmod proxy_fcgi
This will enable both modules as proxy.conf is a dependency of proxy_fcgi.
Now to complete, disable
sudo a2dismod php7.2
Restart apache server
sudo systemctl restart apache2
"ip or domain"/phpinfo.php
The line "Server API" will now confirm " FPM/FastCGI ".
PHP workload is now offloaded from apache process to an independent php server process.
This assumes default Ubuntu LAMP server settings. This does not take into account any previously enabled modules or configurations. Before making any changes to default conf files I recommend creating a backup copy for restoring default settings.
This method is similar for later Ubuntu releases with php7.3 or php 7.4
If any errors are encountered during restart check the apache2 logs files at
/var/log/apache2/ and php logs in