实验要求:
zabbix+grafana 并实现微信报警和邮件报警,使用lnmp+wordpress 完成web,并用zabbix监控,并实时告警
环境:
A:192.168.59.3
B:192.168.59.4
C: 192.168.59.5
实现 lnmp+wordpress
安装epel源
[root@192 ~]# yum -y install epel-release
安装lnmp相关组件 上传WordPress包
[root@192 ~]# yum -y install nginx mariadb mariadb-server php php-server php-mysql php-gd php-fpm php-devel
[root@192 ~]# ls
anaconda-ks.cfg wordpress-4.9.4-zh_CN.zip
修改配置文件
[root@192 ~]# cd /etc/nginx/
[root@192 nginx]# mv nginx.conf.default nginx.conf
[root@192 nginx]# vim nginx.conf
location / {
root html;
index index.php index.html index.htm;
}
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;
}
[root@192 nginx]# cd /usr/share/nginx/html/
[root@192 html]# vim index.php
[root@192 html]# cat index.php
<?php
phpinfo();
?>
[root@192 html]# systemctl restart nginx mariadb php-fpm
部署wordpress
[root@192 ~]# mv wordpress-4.9.4-zh_CN.zip /usr/share/nginx/html/
[root@192 html]# cp -R wordpress/* /usr/share/nginx/html/
cp:是否覆盖"/usr/share/nginx/html/index.php"? yes
[root@192 ~]# chmod -R 777 /usr/share/nginx/html/
[root@192 html]# mysql
MariaDB [(none)]> create database zhang character set utf8;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on *.* to 'feng'@'localhost' by '123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@192 html]# cp wp-config-sample.php wp-config.php
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'zhang');
/** MySQL数据库用户名 */
define('DB_USER', 'feng');
/** MySQL数据库密码 */
define('DB_PASSWORD', '123');
/** MySQL主机 */
define('DB_HOST', 'localhost');