YUM 安装lnmy

yum -y install nginx
systemctl start nginx.service

yum -y install php php-fpm php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear
php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
systemctl start php-fpm.service

yum install mariadb-server
systemctl start mysqld

cd /etc/nginx/conf.d/
vim nginx.conf

在server{} 中添加....

index index.php index.html index.htm;

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
        location ~ .php$ {
        #root html;#注意这一行请注释掉!!!
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        }


cd /usr/share/nginx/html/
vim index.php

<?php
phpinfo();
php?>

重启服务测试

/usr/sbin/nginx -t
/usr/sbin/nginx  -s reopen
原文地址:https://www.cnblogs.com/blogscc/p/8611778.html