可以的,而且非常常见。先澄清一下概念:
所以:
可以,常见两种方式:
fastcgi_pass 把请求交给 PHP-FPM# 安装
yum install nginx php php-fpm mariadb-server -y
# 启动
systemctl start nginx php-fpm mariadb
systemctl enable nginx php-fpm mariadb
Nginx 配置示例:
server {
listen 80;
root /usr/share/nginx/html;
index index.php index.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
CentOS 上完全可以用 Nginx 代替 Apache 来跑 PHP,这不是“LAMP”,而是“LNMP”,而且生产环境很常见。
如果你愿意,我可以帮你: