Ubuntu 24.04
Sponsored Link

Nginx : Use PHP Scripts2024/05/31

 

Configure Nginx to use PHP scripts.

[1]

Install PHP, refer to here.

[2] Install PHP-FPM (PHP FastCGI Process Manager).
root@www:~#
apt -y install php8.3-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.3-fpm.sock;
       }

root@www:~#
systemctl reload php8.3-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