支持。
在 Ubuntu 上搭建 LNMP(Linux + Nginx + MySQL/MariaDB + PHP)环境,PHP 是核心组成部分之一,LNMP 中的 P 就是指 PHP。
Nginx 本身不原生解析 PHP,需要通过 PHP-FPM(FastCGI Process Manager) 来支持 PHP。
以 Ubuntu 20.04 / 22.04 为例:
# 安装 Nginx
sudo apt install nginx
# 安装 PHP 及 PHP-FPM
sudo apt install php-fpm php-mysql
# 配置 Nginx 支持 PHP
Nginx 配置示例(/etc/nginx/sites-available/default):
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
✅ Ubuntu 上的 LNMP 完全支持 PHP
✅ 通常使用 Nginx + PHP-FPM 方式运行 PHP
✅ 可运行 WordPress、Laravel、ThinkPHP 等 PHP 程序
如果你需要,我也可以给你一套 完整 Ubuntu LNMP 安装教程。