首页 > 代码库 > zabbix+LNMP搭建
zabbix+LNMP搭建
Centos 6.5
mysql-5.6.29.tar.gz
nginx-1.10.2.tar.gz
php-5.6.20.tar.gz
zabbix-3.0.4.tar.gz
Nginx安装
新建用户
groupadd nginx
useradd -g nginx -s /sbin/nologin nginx
tar xf nginx-1.10.2.tar.gz
cd nginx-1.10.2
./configure --user=nginx --group=nginx --prefix=/soft/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../nginx/conf/
过滤配置文件
grep -E -v "#|^$" nginx.conf.default > nginx.conf
vim nginx.conf
===========================================================================================
user nginx;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.(php|php6)?$ {
root /soft/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /application/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
}
}
==============================================================================================
测试配置文件,返回OK!
/soft/nginx/sbin/nginx -t
MySQL安装
yum install tree nmap lrzsz dos2unix cmake bison ncurses ncurses-devel -y
cd /soft/mysql-5.6.29
cmake -DCMAKE_INSTALL_PREFIX=/soft/mysql -DMYSQL_DATADIR=/soft/mysql/data1 -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make && make install
cp /soft/mysql-5.6.29/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
vim /etc/my.cnf
=============================================================================================
[client]
socket = /tmp/mysql.sock
[mysqld]
datadir = /soft/mysql/data1
socket = /tmp/mysql.sock
user = mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links = 0
[mysqld_safe]
log-error = /var/log/mysqld.log
pid-file = /var/run/mysqld/mysqld.pid
============================================================================================
groupadd mysql
useradd -g mysql -s /sbin/nologin mysql
/soft/mysql/scripts/mysql_install_db --basedir=/soft/mysql --datadir=/soft/mysql/data1 --user=mysql
source /etc/profile
mysqladmin -u root password ‘testmysql‘
service msyqld start
PHP安装
yum install zlib-devel libxml2-devel libjpeg-devel libiconv-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel libmcrypt-devel mhash mcrypt -y
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/soft/libiconv
make && make install
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
tar xf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
make && make install
php
cmake -DCMAKE_INSTALL_PREFIX=/soft/mysql -DMYSQL_DATADIR=/soft/mysql/data1 -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
cp php.ini-development /soft/php/lib/php.ini
cd /soft/php/etc
cp php-fpm.conf.default php-fpm.conf
配置文件修改
vim /soft/php/lib/php.ini
=========================================
max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 30M
date.timezone = Asia/Shanghai
always_populate_raw_post_data = http://www.mamicode.com/-1
=========================================
/soft/php/sbin/php-fpm
Zabbix安装
yum install net-snmp-devel -y
cd /soft/zabbix-3.0.4
groupadd zabbix
useradd -g zabbix -s /sbin/nologin zabbix
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
make && make install
vim /soft/zabbix/etc/zabbix_server.conf
===========================================
DBUser=zabbix
DBPassword=testmysql
DBSocket=/tmp/mysql.sock
DBPort=3306
PidFile=/soft/zabbix/pid/zabbix_server.pid
DBHost=rm-wz94th3t337i6n647.mysql.rds.aliyuncs.com
JavaGateway=127.0.0.1
JavaGatewayPort=10052
StartJavaPollers=5
CacheSize=1024M
Timeout=30
AlertScriptsPath=/soft/zabbix/share/zabbix/alertscripts
FpingLocation=/soft/fping/sbin/fping
LogSlowQueries=3000
==========================================
zabbix+LNMP搭建