安装
yum install -y nginx mariadb mariadb-server php php-mysql php-devel php-fpm
配置
cd /etc/nginx/ && ls -l
cp nginx.conf{,.bak} && ls -l
vim nginx.conf
添加以下内容
location = / {
index index.php;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
修改完成后 wq 保存并退出
nginx -t
启动
systemctl start nginx php-fpm mariadb
ss -lnt (看到80 9000 3306端口)
cd /usr/share/nginx/html/ && rm -rf ./*
cat << EOF > index.php
<?php
phpinfo()
?>
EOF
使用浏览器访问 IP/index.php 看到如下图表示lnmp部署成功