Ubuntu 22.04
Sponsored Link

Nginx : Use PHP Scripts2022/05/10

 
Configure Nginx to use PHP scripts.
[1]
[2] Install PHP-FPM (PHP FastCGI Process Manager).
root@www:~#
apt -y install php-fpm
[3] Configure Apache2.
# 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/php8.1-fpm.sock;
       }

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

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

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