安装
sudo apt update
sudo apt install php-fpm
systemctl status php7.4-fpm
server {
# . . . other code
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
# 重启
sudo systemctl restart nginx
测试
cd /var/www/html/
vim info.php
<?php
phpinfo();
访问
http://your_server_ip/info.php