Debian 11 Bullseye
Sponsored Link

Nginx : Use PHP Scripts2021/09/10

 
Configure Nginx to use PHP scripts.
[1] Install PHP, refer to here.
root@www:~#
apt -y install php7.4 php7.4-common php-pear php7.4-mbstring php7.4-fpm
[3] Additionally, Install PHP-FPM (PHP FastCGI Process Manager).
# add settings into [server] section of a site definition

root@www:~#
vi /etc/nginx/sites-available/default
       location ~ \.php$ {
              include snippets/fastcgi-php.conf;
              fastcgi_pass unix:/run/php/php7.4-fpm.sock;
       }

root@www:~#
systemctl restart php7.4-fpm nginx
# create PHPInfo test page

root@www:~#
echo '<?php phpinfo(); ?>' > /var/www/html/info.php

[3] Verify to access to PHPInfo test page from any client computer.
Matched Content