龙空技术网

zabbix5.0监控:CentOS7搭建Zabbix服务器

橙子粑粑哦 592

前言:

如今大家对“php页面出不来”都比较看重,大家都需要剖析一些“php页面出不来”的相关知识。那么小编同时在网上汇集了一些对于“php页面出不来””的相关内容,希望各位老铁们能喜欢,同学们一起来了解一下吧!

前言:

请先去zabbix官网看看手册哦。

一、安装centos7操作系统。

这个就很简单了,我是在vmware exsi平台上创建的centos虚机,安装过程就不写了,网络上搜索一大把,没啥难度的。系统语言我就用了中文,没差别,反而不用去考虑时区。

二、关闭防火墙。

systemctl stop firewalld.service      #停止firewalld服务systemctl disable firewalld.service    #设置开机默认不启动getenforce    查看状态vim /etc/sysconfig/selinux    开机不启动     SELINUX=disabled

三、安装zabbix server。

1、创建zabbix用户。

groupadd zabbixuseradd -g zabbix -s /sbin/nologin -m zabbix   #这个用户不能登陆的

2、安装依赖包哦。

yum -y install openssl OpenIPMI-libs  unixODBC libaio   iksemel fping net-snmp net-snmp-utils mysql perl-DBI curl libcurl-devel net-snmp-devel libssh2 libssh2-devel libxml2 libxml2-devel

3、更新源。

#版本,自己可以去更换,找最新的就好,进去自己挑吧。rpm -Uvh ;  yum clean all                         *清理yum缓存

4、安装zabbix 。

yum install zabbix-server-mysql zabbix-agent

5、安装及配置数据库。

安装MySQL服务yum install rh-mysql57-mysql rh-mysql57-mysql-server rh-mysql57-mysql-devel配置MySQL服务vim /etc/opt/rh/rh-mysql57/my.cnfcharacter_set_server = utf8vim /etc/profileexport PATH=/opt/rh/rh-mysql57/root/bin:$PATHsource  /etc/profile启动服务systemctl start rh-mysql57-mysqld

6、创建zabbix数据库。

mysql -uroot -ppassword   #密码是空的,直接回车就进去了mysql> create database zabbix character set utf8 collate utf8_bin;mysql> create user zabbix@localhost identified by 'Zabbix@123';     #创建数据库用户及密码mysql> grant all privileges on zabbix.* to zabbix@localhost;   #授权mysql> quit;

7、导入zabbix数据库架构。

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pZabbix@123 zabbix       最后面的zabbix是数据库名称哦

8、配置zabbix数据库。

vim /etc/zabbix/zabbix_server.confDBPassword=passwordDBSocket=/var/lib/mysql/mysql.sock

9、配置php。

vim /etc/opt/rh/rh-php72/php.inisoap.wsdl_cache_enabled=1max_input_time = 600max_execution_time = 300date.timezone = Asia/Shanghaipost_max_size = 32Mmemory_limit = 128Mmbstring.func_overload = 1vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf[zabbix]user = apachegroup = apachelisten = /var/opt/rh/rh-php72/run/php-fpm/zabbix.socklisten.acl_users = apachelisten.allowed_clients = 127.0.0.1listen.mode = 0666pm = dynamicpm.max_children = 50pm.start_servers = 5pm.min_spare_servers = 5pm.max_spare_servers = 35php_value[session.save_handler] = filesphp_value[session.save_path]    = /var/opt/rh/rh-php72/lib/php/session/php_value[max_execution_time] = 300php_value[memory_limit] = 128Mphp_value[post_max_size] = 16Mphp_value[upload_max_filesize] = 2Mphp_value[max_input_time] = 300php_value[max_input_vars] = 10000; php_value[date.timezone] = Europe/Riga vim /etc/opt/rh/rh-nginx116/nginx/nginx.conf# For more information on configuration, see:#   * Official English Documentation:    * Official Russian Documentation:  nginx;worker_processes auto;error_log /var/opt/rh/rh-nginx116/log/nginx/error.log;pid /var/opt/rh/rh-nginx116/run/nginx/nginx.pid;# Load dynamic modules. See /opt/rh/rh-nginx116/root/usr/share/doc/README.dynamic.include /opt/rh/rh-nginx116/root/usr/share/nginx/modules/*.conf;events {    worker_connections  1024;} http {    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '                      '$status $body_bytes_sent "$http_referer" '                      '"$http_user_agent" "$http_x_forwarded_for"';     access_log  /var/opt/rh/rh-nginx116/log/nginx/access.log  main;     sendfile        on;    tcp_nopush      on;    tcp_nodelay     on;    keepalive_timeout  65;    types_hash_max_size 2048;     include       /etc/opt/rh/rh-nginx116/nginx/mime.types;    default_type  application/octet-stream;     # Load modular configuration files from the /etc/nginx/conf.d directory.    # See     # for more information.    include /etc/opt/rh/rh-nginx116/nginx/conf.d/*.conf;  }vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.confserver {        listen          80;    server_name    10.19.10.90;      #这里要设置  不然无法打开web         root    /usr/share/zabbix;         index   index.php;         location = /favicon.ico {                log_not_found   off;        }         location / {                try_files       $uri $uri/ =404;        }         location /assets {                access_log      off;                expires         10d;        }         location ~ /\.ht {                deny            all;        }         location ~ /(api\/|conf[^\.]|include|locale) {                deny            all;                return          404;        }         location ~ [^/]\.php(/|$) {                fastcgi_pass    unix:/var/opt/rh/rh-php72/run/php-fpm/zabbix.sock;                fastcgi_split_path_info ^(.+\.php)(/.+)$;                fastcgi_index   index.php;                 fastcgi_param   DOCUMENT_ROOT   /usr/share/zabbix;                fastcgi_param   SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;                fastcgi_param   PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;                 include fastcgi_params;                fastcgi_param   QUERY_STRING    $query_string;                fastcgi_param   REQUEST_METHOD  $request_method;                fastcgi_param   CONTENT_TYPE    $content_type;                fastcgi_param   CONTENT_LENGTH  $content_length;                 fastcgi_intercept_errors        on;                fastcgi_ignore_client_abort     off;                fastcgi_connect_timeout         60;                fastcgi_send_timeout            180;                fastcgi_read_timeout            180;                fastcgi_buffer_size             128k;                fastcgi_buffers                 4 256k;                fastcgi_busy_buffers_size       256k;                fastcgi_temp_file_write_size    256k;        }}

10、重启zabbix。

 systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm rh-mysql57-mysqld

四、配置web前端。

如果没有显示界面,可能就是php设置有误,请重新去检查下吧。

检查所有是否OK。

输入帐号密码。

输入数据库名称。

配置完成,这样就可以看到画面了。

总结:

配置过程中,总是出现很多问题,也搜索了很多文章,借鉴了很多大神的文档。如果web界面出不来,多半是php和nginx配置不正确,重点检查nginx.conf。

标签: #php页面出不来