Heim >Backend-Entwicklung >PHP-Tutorial >Beispielcode-Sharing für LNMP- und Zabbix-Konfiguration
In diesem Artikel wird hauptsächlich der Beispielcode für die LNMP- und Zabbix-Konfiguration mit Ihnen geteilt, in der Hoffnung, allen zu helfen.
1. Bereitstellung des Zabbix-Servers
1. Entpacken
tar -xf nginx-1.10.1.tar.gz tar -xf php-5.6.22.tar.gz tar -xf freetype-2.4.0.tar.bz2 tar -xf mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz tar -xf zabbix-3.2.1.tar.gz2. Installieren Sie Nginx
>
3. Installieren Sie MySQLyum -y install gcc openssl-devel pcre-devel useradd -s /sbin/nologin nginx cd ~/nginx-1.10.1/ ./configure \ >--prefix=/usr/local/nginx \ >--user=nginx \ >--group=nginx \ >--with-http_ssl_module make && make install vim /usr/local/nginx/conf/nginx.conf location / { roothtml; indexindex.phpindex.htmlindex.htm; } location ~ \.php$ { root html; fastcgi_pass127.0.0.1:9000; fastcgi_indexindex.php; fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name; includefastcgi_params; } /usr/local/nginx/sbin/nginx4. Installieren Sie Freetype (Sie können das mit dem System gelieferte verwenden)
useradd mysql mv mysql-5.6.30-linux-glibc2.5-x86_64/ /usr/local/mysql chown -R mysql.mysql /usr/local/mysql/ su - mysql cd /usr/local/mysql/scripts/ ./mysql_install_db \ >--user=mysql \ >--basedir=/usr/local/mysql \ >--datadir=/usr/local/mysql/data exit cd /usr/local/mysql/support-files/ cp my-default.cnf /etc/my.cnf cp mysql.server /etc/init.d/mysql vim /etc/init.d/mysql basedir=/usr/local/mysql datadir=/usr/local/mysql/data echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile source /etc/profile chkconfig --add mysql chkconfig mysql on service mysql start /usr/local/mysql/bin/mysqladmin -u root password '123456' mysql -uroot -p123456 mysql> create database zabbix character set utf8; mysql> grant all on zabbix.* to zabbix@localhost identified by 'qwe123';5. PHP installieren
cd ~/freetype-2.4.0 ./configure --prefix=/opt/freetype-2.4.0 make && make install yum -y install freetype6. Zabbix installieren
yum -y install libjpeg-devel libxml2-devel libpng-devel cd ~/php-5.6.22/ ./configure \ >--prefix=/usr/local/php5/ \ >--enable-fpm \ >--enable-mbstring \ >--enable-bcmath \ >--enable-sockets \ >--with-config-file-path=/usr/local/php5/etc \ >--with-mysql=/usr/local/mysql/ \ >--with-mysqli=/usr/local/mysql/bin/mysql_config \ >--with-gd \ >--with-gettext \ >--with-jpeg-dir \ >--with-freetype-dir=/opt/freetype-2.4.0/ #使用系统自带的不用指安装目录 make && make install cp php.ini-production /usr/local/php5/etc/php.ini vim /usr/local/php5/etc/php.ini date.timezone = Asia/Shanghai max_execution_time = 300 post_max_size = 32M max_input_time = 300 memory_limit = 128M always_populate_raw_post_data = -1 cd /usr/local/php5/etc/ cp php-fpm.conf.default php-fpm.conf vim php-fpm.conf pid = run/php-fpm.pid error_log = log/php-fpm.log log_level = error daemonize = yes user = nginx group = nginx listen = 127.0.0.1:9000 pm = dynamic pm.max_children = 32 pm.start_servers = 15 pm.min_spare_servers = 5 pm.max_spare_servers = 32 cd ~/php-5.6.22/sapi/fpm/ cp init.d.php-fpm /etc/rc.d/init.d/php-fpm chmod +x /etc/rc.d/init.d/php-fpm chkconfig --add php-fpm chkconfig php-fpm on service php-fpm start
2. Zabbix-Client-Bereitstellung
yum -y install net-snmp-devel curl-devel useradd zabbix cd zabbix-3.2.1 ./configure \ >--prefix=/usr/local/zabbix \ >--enable-server \ >--enable-proxy \ >--enable-agent \ >--with-mysql=/usr/local/mysql/bin/mysql_config \ >--with-net-snmp \ >--with-libcurl make && make install cd ~/zabbix-3.2.1/database/mysql/ mysql -uzabbix -pqwe123 zabbix < schema.sql mysql -uzabbix -pqwe123 zabbix < images.sql mysql -uzabbix -pqwe123 zabbix < data.sql mkdir /var/log/zabbix chown zabbix.zabbix /var/log/zabbix ln -s /usr/local/zabbix/etc/ /etc/zabbix ln -s /usr/local/zabbix/bin/* /usr/bin/ ln -s /usr/local/zabbix/sbin/* /usr/sbin/ ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18 #可以使用设置搜索库文件的路径方式实现 [root@localhost LNMP+zabbix-3.2.1]# tail -1 /etc/ld.so.conf /usr/local/mysql/lib/ [root@localhost LNMP+zabbix-3.2.1]# ldconfig -v | grep libmysqlclient.so.18 cd ~/zabbix-3.2.1/misc/init.d/fedora/core cp zabbix_* /etc/init.d/ vim /etc/init.d/zabbix_server BASEDIR=/usr/local/zabbix vim /etc/init.d/zabbix_agentd BASEDIR=/usr/local/zabbix vim /etc/services zabbix-agent10050/tcp# Zabbix Agent zabbix-agent10050/udp# Zabbix Agent zabbix-server10051/tcp# Zabbix Trapper zabbix-server10051/udp# Zabbix Trapper vim /etc/zabbix/zabbix_server.conf DBName=zabbix DBUser=zabbix DBPassword=qwe123 LogFile=/var/log/zabbix/zabbix_server.log vim /etc/zabbix/zabbix_agentd.conf Server=127.0.0.1,192.168.100.10 ServerActive=192.168.100.10:10051 Hostname=zabbix server LogFile=/var/log/zabbix/zabbix_server.log UnsafeUserParemeters=1 cd ~/zabbix-3.2.1/frontends/ cp -r php/ /usr/local/nginx/html/zabbix chown -R nginx.nginx /usr/local/nginx/html/zabbix/ service zabbix_server start chkconfig zabbix_server on service zabbix_agentd start chkcongig zabbix_agentd on
Client-Zugriff:
Firefox http://192.168.100.10/zabbix
tar -xf zabbix-3.2.1.tar.gz yum -y install gcc useradd zabbix ./configure --prefix=/usr/local/zabbix --enable-agent && make && make install mkdir /var/log/zabbix chown zabbix.zabbix /var/log/zabbix/ cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/ chmod +x /etc/init.d/zabbix_agentd ln -s /usr/local/zabbix/etc/ /etc/zabbix ln -s /usr/local/zabbix/bin/* /usr/bin/ ln -s /usr/local/zabbix/sbin/* /usr/sbin/ vim /etc/zabbix/zabbix_agentd.conf LogFile=/var/log/zabbix/zabbix_agentd.log Server=127.0.0.1,192.168.100.10 ServerActive=192.168.100.10:10051 Hostname=zabbix client UnsafeUserParameters=1 vim /etc/init.d/zabbix_agentd BASEDIR=/usr/local/zabbix chkconfig zabbix_agentd on service zabbix_agentd startStandard-Anmeldename/Passwort: admin/zabbixVerwandte Empfehlungen:
Detaillierte Einführung in die Installation von Zabbix auf Centos7
Zabbix-Überwachung der Linux-Host-Einstellungsmethode
LNMP-Kompilierung und Installation von PHP und Weitergabe von LNMP-Konfigurations- und Verifizierungsbeispielen
Das obige ist der detaillierte Inhalt vonBeispielcode-Sharing für LNMP- und Zabbix-Konfiguration. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!