user nobody nobody; worker_processes 2; error_log /usr/local/nginx/logs/nginx_error.log crit; pid /usr/local/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; worker_connections 6000; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 3526; server_names_hash_max_size 4096; log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]' '$host "$request_uri" $status' '"$http_referer" "$http_user_agent"'; sendfile on; tcp_nopush on; keepalive_timeout 30; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; connection_pool_size 256; client_header_buffer_size 1k; large_client_header_buffers 8 4k; request_pool_size 4k; output_buffers 4 32k; postpone_output 1460; client_max_body_size 10m; client_body_buffer_size 256k; client_body_temp_path /usr/local/nginx/client_body_temp; proxy_temp_path /usr/local/nginx/proxy_temp; fastcgi_temp_path /usr/local/nginx/fastcgi_temp; fastcgi_intercept_errors on; tcp_nodelay on; gzip on; gzip_min_length 1k; gzip_buffers 4 8k; gzip_comp_level 5; gzip_http_version 1.1; gzip_types text/plain application/x-Javascript text/css text/htm application/xml; server { listen 80; server_name localhost; index index.html index.htm index.php; root /usr/local/nginx/html; location ~ \.php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name; } } } View Code
2. 创建PHP测试网页
vim /usr/local/nginx/html/test.php
<?php phpinfo(); ?>
3. 在浏览器中输入localhost/test.php,测试php页面
4. 配置PHP参数,Zabbix的硬件要求
vim /usr/local/php/etc/php.ini
max_execution_time = 300 max_input_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M date.timezone = Asia/Shanghai always_populate_raw_post_data = -1
5. 重启PHP
service php-pfm stop service php-pfm start
第五部分 安装Zabbix
1. 下载安装zabbix的YUM源
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
2. 安装Zabbix
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get
3. 安装之后进入MySQL数据库,创建Zabbix数据库
create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'zabbixpass'; flush privileges;
4. 导入Zabbix到数据库
cd /usr/share/doc/zabbix-server-mysql-3.0.1/ zcat create.sql.gz |mysql -uroot -ppass zabbix
5. 配置zabbix用户
groupadd zabbix useradd -g zabbix -s /bin/false zabbix
6. 配置Zabbix服务器端
vim /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbixpass cd /usr/share/ cp -r zabbix /usr/local/nginx/html chown -R zabbix:zabbix /etc/zabbix chown -R zabbix:zabbix /usr/share/zabbix chown -R zabbix:zabbix /usr/lib/zabbix
7. Zabbix加入开机启动并启动
systemctl enable zabbix-server systemctl start zabbix-server
8. 在浏览器中测试Zabbix
常见错误排除