文章目录
基于LNMP环境搭建Zabbix监控
关闭防火墙
systemctl stop firewalld
setennfore 0
1、安装nginx
1)创建nginx的yum仓库
vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
2)安装并启动
yum list
yum -y install nginx
systemctl start nginx
systemctl enable nginx
netstat -natp | grep 80
2、安装mysql
1)安装mariadb
yum -y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
netstat -natp | grep 3306
2)初始化
mysql_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n]
New password:
Re-enter new password:
Remove anonymous users?
Disallow root login remotely?
Remove test database and access to it?
Reload privilege tables now?
3)登录验证
mysql -u root -p123123
3、安装PHP
yum -y install epel-release #安装PHP
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm #yum源的建立
yum install -y php72w php72w-devel php72w-fpm php72w-gd php72w-mbstring php72w-mysql #安装环境依赖包
php -v #查看版本
4、修改php-fpm配置文件,把apache改为nginx
vim /etc/php-fpm.d/www.conf
user = nginx #第8行将apache改为nginx
group = nginx #第10行将apache改为nginx