CentOS Stream 10
Sponsored Link

Nginx : Use PHP Scripts2025/01/30

 

Configure Nginx to use PHP scripts.

[1]

Install PHP, refer to here.

[2]

After installing PHP, Restart Nginx, it's OK to do it only.

When [Nginx] starts, [php-fpm] also starts for dependency by setting file [/etc/systemd/system/nginx.service.d/php-fpm.conf].
PHP-FPM config file is located at [/etc/nginx/conf.d/php-fpm.conf].
[root@www ~]#
systemctl restart nginx

[root@www ~]#
systemctl status php-fpm

● php-fpm.service - The PHP FastCGI Process Manager
     Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; preset: disabled)
     Active: active (running) since Thu 2025-01-30 09:13:48 JST; 5s ago
 Invocation: 5b7a18a6f05443a2aa668c95a2756215
   Main PID: 2593 (php-fpm)
     Status: "Ready to handle connections"
      Tasks: 6 (limit: 23144)
     Memory: 13.8M (peak: 14.2M)
        CPU: 31ms
     CGroup: /system.slice/php-fpm.service
.....
.....

# create PHPInfo test page

[root@www ~]#
echo '<?php phpinfo(); ?>' > /usr/share/nginx/html/info.php

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