首先我已经讲yum源设置为阿里源
[root@localhost ~]# yum install nginx php php-devel php-mysql php-fpm
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
1.问题:没有可用软件包 nginx。
解决:[root@localhost ~]# sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
sudo yum install -y nginx
[root@localhost ~]# systemctl start mariadb
2.问题:Failed to start mariadb.service: Unit not found
解决:1.[root@localhost ~]# yum install -y mariadb
2.[root@localhost ~]# yum install -y mariadb-server
启动Nginx并设置开机自动运行
systemctl start nginx.service
systemctl enable nginx.service
1.[root@localhost ~]# yum install -y mariadb
2.[root@localhost ~]# yum install -y mariadb-server
启动Nginx并设置开机自动运行
sudo systemctl start nginx.service
sudo systemctl enable nginx.service
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# ps -ef |grep mariadb
mysql 6774 6612 0 10:28 ? 00:00:00 /usr/libexec/mysqld
--basedir=/usr --datadir=/var/lib/mysql
--plugin-dir=/usr/lib64/mysql/plugin
--log-error=/var/log/mariadb/mariadb.log
--pid-file=/var/run/mariadb/mariadb.pid
--socket=/var/lib/mysql/mysql.sock
root 6828 978 0 10:30 pts/0 00:00:00 grep --color=auto mariadb
[root@localhost ~]# mysql
Welcome to the MariaDB monitor. Commands end with ;
MariaDB [(none)]> create database zabbix charset=utf8;
Query OK, 1 row affected (0.34 sec)
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by'123456';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
上传安装包
解压
安装
--------------------------------------------------------
整合nginx 和php是需要先写好php测试页面
因为是yum安装的所以Location 不是写在nginx.cnf,而是写在conf.d下的default.conf

当不能点下一步的时候需要setfacl -R -m u:nginx:rwx /var/lib/php
来源:https://www.cnblogs.com/xiaoxingxing01/p/12166045.html