首页 文章 精选 留言 我的

精选列表

搜索[运维安全中心(堡垒机)],共10000篇文章
优秀的个人博客,低调大师

Apache运维架构之Apache+PHP

当前互联网主流web服务器说明 1、IIS 微软的web服务器 2、apache 中小web服务器主流,web服务器中的老大哥 3、nginx 新兴的web服务器主流 4、tomcat 中小企业动态服务器,互联网java容器主流 5、resin 大型企业动态服务器,互联网java容器主流 apache的特点及应用场合 特点:功能强大,配置简单,速度快,应用广泛,性能稳定可靠,并可做代理服务器和负载均衡 应用场合: 1、使用apache来运行静态html网页,图片,处理静态小文件能力不及nginx 2、使用apache结合php引擎来运行php程序,lamp由此成为经典组合 3、使用apache结合tomcat及resin运行jsp java等程序,成为中小企业的首选 4、使用apache做代理及负载均衡 本次环境所用到的软件版本如下(操作系统centos6.7) 1、基础环境准备 [root@ansibletools]#tarxfapr-1.4.5.tar.gz [root@ansibletools]#cdapr-1.4.5 [root@ansibleapr-1.4.5]#./configure--prefix=/usr/local/apr [root@ansibleapr-1.4.5]#make&&makeinstall [root@ansibletools]#tarxfapr-util-1.3.12.tar.gz [root@ansibletools]#cdapr-util-1.3.12 [root@ansibleapr-util-1.3.12]#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/apr-1-config [root@ansibleapr-util-1.3.12]#make&&makeinstall [root@ansiblepcre-8.10]#unzippcre-8.10.zip [root@ansibletools]#cdpcre-8.10 [root@ansiblepcre-8.10]#./configure--prefix=/usr/local/pcre [root@ansiblepcre-8.10]#make&&makeinstall [root@ansibletools]#tarxflibxml2-2.7.6.tar.gz [root@ansibletools]#cdlibxml2-2.7.6 [root@ansiblelibxml2-2.7.6]#vimconfigure将下面那行注释掉 #$RM"$cfgfile" [root@ansiblelibxml2-2.7.6]#./configure--prefix=/usr/local/libxml2--without-zlib [root@ansiblelibxml2-2.7.6]#make&&makeinstall [root@ansibletools]#tarxflibmcrypt-2.5.8.tar.gz [root@ansibletools]#cdlibmcrypt-2.5.8 [root@ansiblelibmcrypt-2.5.8]#./configure--prefix=/usr/local/libmcrypt [root@ansiblelibmcrypt-2.5.8]#make&&makeinstall [root@ansibletools]#tarxfzlib-1.2.5.tar.gz [root@ansibletools]#cdzlib-1.2.5 [root@ansiblezlib-1.2.5]#./configure [root@ansiblezlib-1.2.5]#make&&makeinstall [root@ansibletools]#tarxflibpng-1.4.1.tar.gz [root@ansibletools]#cdlibpng-1.4.1 [root@ansiblelibpng-1.4.1]#./configure--prefix=/usr/local/libpng [root@ansiblelibpng-1.4.1]#make&&makeinstall [root@ansibletools]#mkdir/usr/local/jpeg6 [root@ansibletools]#mkdir/usr/local/jpeg6/bin [root@ansibletools]#mkdir/usr/local/jpeg6/lib [root@ansibletools]#mkdir/usr/local/jpeg6/include [root@ansibletools]#mkdir-p/usr/local/jpeg6/man/man1 [root@ansibletools]#tarxfjpegsrc.v6b.tar.gz [root@ansibletools]#cdjpeg-6b/ [root@ansiblejpeg-6b]#./configure--prefix=/usr/local/jpeg6/--enable-shared--enable-static [root@ansiblejpeg-6b]#make&&make报错 ./libtool--mode=compilegcc-O2-I.-c./jcapimin.c make:./libtool:Commandnotfound make:***[jcapimin.lo]Error127 解决方法 [root@ansibletools]#tarxflibtool-2.2.6a.tar.gz [root@ansibletools]#cdlibtool-2.2.6 [root@ansiblelibtool-2.2.6]#./configure [root@ansiblelibtool-2.2.6]#make&&makeinstall [root@ansiblelibtool-2.2.6]#cd../jpeg-6b/ [root@ansiblejpeg-6b]#cp/usr/share/libtool/config/config.sub. [root@ansiblejpeg-6b]#cp/usr/share/libtool/config/config.guess. [root@ansiblejpeg-6b]#./configure--prefix=/usr/local/jpeg6/--enable-shared--enable-static [root@ansiblejpeg-6b]#make&&make [root@ansibletools]#tarxffreetype-2.3.12.tar.gz [root@ansibletools]#cdfreetype-2.3.12 [root@ansiblefreetype-2.3.12]#./configure--prefix=/usr/local/freetype [root@ansiblefreetype-2.3.12]#make&&makeinstall [root@ansibletools]#tarxfautoconf-2.61.tar.gz [root@ansibletools]#cdautoconf-2.61 [root@ansibleautoconf-2.61]#./configure [root@ansibleautoconf-2.61]#make&&makeinstall [root@ansibletools]#tarxflibgd-2.1.1.tar. libgd-2.1.1.tar.gzlibgd-2.1.1.tar.xz [root@ansibletools]#tarxflibgd-2.1.1.tar.gz [root@ansibletools]#cdlibgd-2.1.1 [root@ansiblelibgd-2.1.1]#./configure\ >--prefix=/usr/local/gd2/\ >--enable-m4_pattern_allow\ >--with-zlib=/usr/local/zlib/\ >--with-jpeg=/usr/local/jpeg6/\ >--with-png=/usr/local/libpng/\ >--with-freetype=/usr/local/freetype/ [root@ansiblelibgd-2.1.1]#make&&makeinstall 2、安装编译apache [root@ansibletools]#useradd-s/sbin/nologin-Mwww [root@ansibletools]#tarxfhttpd-2.4.18.tar.bz2 [root@ansibletools]#cdhttpd-2.4.18 [root@ansiblehttpd-2.4.18]#./configure--prefix=/usr/local/apache2--enable-mods-shared=all--enable-so--enable-proxy-ajp--enable-rewrite--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/--with-pcre=/usr/local/pcre/ [root@ansiblehttpd-2.4.18]#make&&makeinstall 3、安装编译mysql [root@ansiblemysql-5.6.17]#useradd-s/sbin/nologin-Mmysql [root@ansiblemysql-5.6.17]#yuminstallcmake-y [root@ansibletools]#tarxfmysql-5.6.17.tar.gz [root@ansibletools]#cdmysql-5.6.17 [root@ansiblemysql-5.6.17]#cmake\ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ -DMYSQL_DATADIR=/usr/local/mysql/data\ -DSYSCONFDIR=/etc\ -DWITH_MYISAM_STORAGE_ENGINE=1\ -DWITH_INNOBASE_STORAGE_ENGINE=1\ -DWITH_MEMORY_STORAGE_ENGINE=1\ -DWITH_READLINE=1\ -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.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 [root@ansiblemysql-5.6.17]#make&&makeinstall [root@ansiblemysql-5.6.17]#chown-Rmysql.mysql/usr/local/mysql/ [root@ansiblescripts]#pwd /tools/mysql-5.6.17/scripts [root@ansiblescripts]#chmod+xmysql_install_db [root@ansiblescripts]#./mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user=mysql InstallingMySQLsystemtables...2016-08-1913:13:180[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails). 2016-08-1913:13:1864062[Note]InnoDB:Usingatomicstorefcountbufferpoolpages 2016-08-1913:13:1864062[Note]InnoDB:TheInnoDBmemoryheapisdisabled 2016-08-1913:13:1864062[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins 2016-08-1913:13:1864062[Note]InnoDB:Compressedtablesusezlib1.2.3 2016-08-1913:13:1864062[Note]InnoDB:NotusingCPUcrc32instructions 2016-08-1913:13:1864062[Note]InnoDB:Initializingbufferpool,size=128.0M 2016-08-1913:13:1864062[Note]InnoDB:Completedinitializationofbufferpool 2016-08-1913:13:1864062[Note]InnoDB:Thefirstspecifieddatafile./ibdata1didnotexist:anewdatabasetobecreated! 2016-08-1913:13:1864062[Note]InnoDB:Settingfile./ibdata1sizeto12MB 2016-08-1913:13:1864062[Note]InnoDB:Databasephysicallywritesthefilefull:wait... 2016-08-1913:13:1964062[Note]InnoDB:Settinglogfile./ib_logfile101sizeto48MB 2016-08-1913:13:2164062[Note]InnoDB:Settinglogfile./ib_logfile1sizeto48MB 2016-08-1913:13:2364062[Note]InnoDB:Renaminglogfile./ib_logfile101to./ib_logfile0 2016-08-1913:13:2364062[Warning]InnoDB:Newlogfilescreated,LSN=45781 2016-08-1913:13:2364062[Note]InnoDB:Doublewritebuffernotfound:creatingnew 2016-08-1913:13:2364062[Note]InnoDB:Doublewritebuffercreated 2016-08-1913:13:2364062[Note]InnoDB:128rollbacksegment(s)areactive. 2016-08-1913:13:2364062[Warning]InnoDB:Creatingforeignkeyconstraintsystemtables. 2016-08-1913:13:2364062[Note]InnoDB:Foreignkeyconstraintsystemtablescreated 2016-08-1913:13:2364062[Note]InnoDB:Creatingtablespaceanddatafilesystemtables. 2016-08-1913:13:2364062[Note]InnoDB:Tablespaceanddatafilesystemtablescreated. 2016-08-1913:13:2364062[Note]InnoDB:Waitingforpurgetostart 2016-08-1913:13:2364062[Note]InnoDB:5.6.17started;logsequencenumber0 2016-08-1913:13:2464062[Note]Binlogend 2016-08-1913:13:2464062[Note]InnoDB:FTSoptimizethreadexiting. 2016-08-1913:13:2464062[Note]InnoDB:Startingshutdown... 2016-08-1913:13:2464062[Note]InnoDB:Shutdowncompleted;logsequencenumber1625977 OK Fillinghelptables...2016-08-1913:13:240[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails). 2016-08-1913:13:2464085[Note]InnoDB:Usingatomicstorefcountbufferpoolpages 2016-08-1913:13:2464085[Note]InnoDB:TheInnoDBmemoryheapisdisabled 2016-08-1913:13:2464085[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins 2016-08-1913:13:2464085[Note]InnoDB:Compressedtablesusezlib1.2.3 2016-08-1913:13:2464085[Note]InnoDB:NotusingCPUcrc32instructions 2016-08-1913:13:2464085[Note]InnoDB:Initializingbufferpool,size=128.0M 2016-08-1913:13:2464085[Note]InnoDB:Completedinitializationofbufferpool 2016-08-1913:13:2464085[Note]InnoDB:HighestsupportedfileformatisBarracuda. 2016-08-1913:13:2464085[Note]InnoDB:128rollbacksegment(s)areactive. 2016-08-1913:13:2564085[Note]InnoDB:Waitingforpurgetostart 2016-08-1913:13:2564085[Note]InnoDB:5.6.17started;logsequencenumber1625977 2016-08-1913:13:2564085[Note]Binlogend 2016-08-1913:13:2564085[Note]InnoDB:FTSoptimizethreadexiting. 2016-08-1913:13:2564085[Note]InnoDB:Startingshutdown... 2016-08-1913:13:2664085[Note]InnoDB:Shutdowncompleted;logsequencenumber1625987 OK Tostartmysqldatboottimeyouhavetocopy support-files/mysql.servertotherightplaceforyoursystem PLEASEREMEMBERTOSETAPASSWORDFORTHEMySQLrootUSER! Todoso,starttheserver,thenissuethefollowingcommands: /usr/local/mysql/bin/mysqladmin-urootpassword'new-password' /usr/local/mysql/bin/mysqladmin-uroot-hansiblepassword'new-password' Alternativelyyoucanrun: /usr/local/mysql/bin/mysql_secure_installation whichwillalsogiveyoutheoptionofremovingthetest databasesandanonymoususercreatedbydefault.Thisis stronglyrecommendedforproductionservers. Seethemanualformoreinstructions. YoucanstarttheMySQLdaemonwith: cd.;/usr/local/mysql/bin/mysqld_safe& YoucantesttheMySQLdaemonwithmysql-test-run.pl cdmysql-test;perlmysql-test-run.pl Pleasereportanyproblemsathttp://bugs.mysql.com/ ThelatestinformationaboutMySQLisavailableonthewebat http://www.mysql.com SupportMySQLbybuyingsupport/licensesathttp://shop.mysql.com Newdefaultconfigfilewascreatedas/usr/local/mysql/my.cnfand willbeusedbydefaultbytheserverwhenyoustartit. Youmayeditthisfiletochangeserversettings 注:在启动MySQL服务时,会按照一定次序搜索my.cnf,先在/etc目录下找,找不到则会搜索"$basedir/my.cnf", 在本例中就是/usr/local/mysql/my.cnf,这是新版MySQL的配置文件的默认位置! [root@ansiblehttpd-2.4.18]#cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld [root@ansiblehttpd-2.4.18]#chmod+x/etc/init.d/mysqld [root@ansiblehttpd-2.4.18]#/etc/init.d/mysqldstart StartingMySQL.......SUCCESS! 4、编译安装php [root@ansiblephp-5.6.18]#yuminstalllibXpm-devel-y [root@ansibletools]#tarxfphp-5.6.18.tar.gz [root@ansibletools]#cdphp-5.6.18 [root@ansiblephp-5.6.18]#./configure\ --prefix=/usr/local/php\ --with-config-file-path=/usr/local/php/etc\ --with-apxs2=/usr/local/apache2/bin/apxs\ --with-mysql=/usr/local/mysql/\ --with-libxml-dir=/usr/local/libxml2/\ --with-png-dir=/usr/local/libpng/\ --with-jpeg-dir=/usr/local/jpeg6/\ --with-freetype-dir=/usr/local/freetype/\ --with-gd=/usr/local/gd2/\ --with-zlib-dir=/usr/local/zlib/\ --with-mcrypt=/usr/local/libmcrypt/\ --with-mysqli=/usr/local/mysql/bin/mysql_config\ --with-xpm-dir=/usr/lib64/\ --enable-soap\ --enable-mbstring=all\ --enable-sockets [root@ansiblephp-5.6.18]#make&&makeinstall 5、apache配置 [root@ansiblephp-5.6.18]#vim/usr/local/apache2/conf/httpd.conf ServerNamelocalhost DirectoryIndexindex.phpindex.html AddType application/x-httpd-php.php.phtml AddTypeapplication/x-httpd-php-source.phps Includeconf/extra/httpd-vhosts.conf LoadModulephp5_modulemodules/libphp5.so Userwww Groupwww [root@ansiblephp-5.6.18]#vim/usr/local/apache2/conf/extra/httpd-vhosts.conf #VirtualHosts <VirtualHost*:80> ServerAdmin1335120568@qq.com DocumentRoot"/usr/local/apache2/htdocs/www" ServerNamewww.martin1.com ServerAliasmartin1.com ErrorLog"logs/www-error_log" CustomLog"logs/www-access_log"common </VirtualHost> <VirtualHost*:80> ServerAdmin1335120568@qq.com DocumentRoot"/usr/local/apache2/htdocs/blog" ServerNameblog.martin1.com ErrorLog"logs/blog-error_log" CustomLog"logs/blog-access_log"common </VirtualHost> [root@ansiblephp-5.6.18]#mkdir-p/usr/local/apache2/htdocs/{www,blog} [root@ansiblephp-5.6.18]#vim/usr/local/apache2/htdocs/www/index.php <?php phpinfo(); ?> [root@ansible php-5.6.18]# /usr/local/apache2/bin/apachectl restart [root@ansible php-5.6.18]# lsof -i :80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 8307 root 4u IPv6 295815 0t0 TCP *:http (LISTEN) httpd 8309 www 4u IPv6 295815 0t0 TCP *:http (LISTEN) httpd 8310 www 4u IPv6 295815 0t0 TCP *:http (LISTEN) httpd 8312 www 4u IPv6 295815 0t0 TCP *:http (LISTEN) 6、访问测试(如果出现php页面,则说明整合成功) 再简单截图之前编译安装的过程 最后说下如果要在lamp环境下安装编译zabbix 按照如下操作即可 ./configure--prefix=/usr/local/zabbix-server --enable-server --with-mysql--with-net-snmp --with-libcurl --with-libxml2cp -a/home/oldboy/tools/zabbix-3.0.3/frontends/php/* /usr/local/apache2/htdocs/www/

优秀的个人博客,低调大师

运维监控平台之zabbix详解1

本来是想一篇文章介绍完的,写着写着发现篇幅太长,所以决定还是分两篇来介绍,本次软件所用的版本信息如下(基于LNMP环境),操作系统centos6.7 nginx-1.6.3.tar.gz php-5.6.24.tar.gz mysql-5.5.49-linux2.6-x86_64.tar.gz zabbix-3.0.4.tar.gz (zabbix-3以上版本之支持php5.4以上环境) LNMP环境搭建不再这里说明了,如果不懂的看本人之前写的nginx+php,这里简单介绍下php编译 [root@centos02tools]#wgethttp://cn2.php.net/distributions/php-5.6.24.tar.gz [root@centos02tools]#tarxfphp-5.6.24.tar.gz [root@centos02tools]#cdphp-5.6.24 [root@centos02php-5.6.24]#./configure\ >--prefix=/application/php5.6.24\ >--with-mysql=/application/mysql\ >--with-pdo-mysql=mysqlnd--with-mysqli=mysqlnd >--with-iconv-dir=/usr/local/libiconv\ >--with-freetype-dir\ >--with-jpeg-dir\ >--with-png-dir\ >--with-zlib\ >--with-libxml-dir=/usr\ >--enable-xml\ >--disable-rpath\ >--enable-safe-mode\ >--enable-bcmath\ >--enable-shmop\ >--enable-sysvsem\ >--enable-inline-optimization\ >--with-curl\ >--with-curlwrappers\ >--enable-mbregex\ >--enable-fpm\ >--enable-mbstring\ >--with-mcrypt\ >--with-gd\ >--enable-gd-native-ttf\ >--with-openssl\ >--with-mhash\ >--enable-pcntl\ >--enable-sockets\ >--with-xmlrpc\ >--enable-zip\ >--enable-soap\ >--enable-short-tags\ >--enable-zend-multibyte\ >--enable-static\ >--with-xsl\ >--with-fpm-user=nginx\ >--with-fpm-group=nginx\ >--enable-ftp >--with-gettext Generatingfiles configure:creating./config.status creatingmain/internal_functions.c creatingmain/internal_functions_cli.c +--------------------------------------------------------------------+ |License:| |ThissoftwareissubjecttothePHPLicense,availableinthis| |distributioninthefileLICENSE.Bycontinuingthisinstallation| |process,youareboundbythetermsofthislicenseagreement.| |Ifyoudonotagreewiththetermsofthislicense,youmustabort| |theinstallationprocessatthispoint.| +--------------------------------------------------------------------+ ThankyouforusingPHP. config.status:creatingphp5.spec config.status:creatingmain/build-defs.h config.status:creatingscripts/phpize config.status:creatingscripts/man1/phpize.1 config.status:creatingscripts/php-config config.status:creatingscripts/man1/php-config.1 config.status:creatingsapi/cli/php.1 config.status:creatingsapi/fpm/php-fpm.conf config.status:creatingsapi/fpm/init.d.php-fpm config.status:creatingsapi/fpm/php-fpm.service config.status:creatingsapi/fpm/php-fpm.8 config.status:creatingsapi/fpm/status.html config.status:creatingsapi/cgi/php-cgi.1 config.status:creatingext/phar/phar.1 config.status:creatingext/phar/phar.phar.1 config.status:creatingmain/php_config.h config.status:executingdefaultcommands configure:WARNING:unrecognizedoptions:--enable-safe-mode,--with-curlwrappers,--enable-zend-multibyte 编译过程截图如下 [root@centos02application]#ln-s/application/mysql/lib/libmysqlclient.so.18/usr/lib64/ [root@centos02application]#touchext/phar/phar.phar [root@centos02application]#make&&makeinstall Buildcomplete. Don'tforgettorun'maketest'. Installingsharedextensions:/application/php5.6.24/lib/php/extensions/no-debug-non-zts-20131226/ InstallingPHPCLIbinary:/application/php5.6.24/bin/ InstallingPHPCLImanpage:/application/php5.6.24/php/man/man1/ InstallingPHPFPMbinary:/application/php5.6.24/sbin/ InstallingPHPFPMconfig:/application/php5.6.24/etc/ InstallingPHPFPMmanpage:/application/php5.6.24/php/man/man8/ InstallingPHPFPMstatuspage:/application/php5.6.24/php/php/fpm/ InstallingPHPCGIbinary:/application/php5.6.24/bin/ InstallingPHPCGImanpage:/application/php5.6.24/php/man/man1/ Installingbuildenvironment:/application/php5.6.24/lib/php/build/ Installingheaderfiles:/application/php5.6.24/include/php/ Installinghelperprograms:/application/php5.6.24/bin/ program:phpize program:php-config Installingmanpages:/application/php5.6.24/php/man/man1/ page:phpize.1 page:php-config.1 InstallingPEARenvironment:/application/php5.6.24/lib/php/ [PEAR]Archive_Tar-installed:1.4.0 [PEAR]Console_Getopt-installed:1.4.1 [PEAR]Structures_Graph-installed:1.1.1 [PEAR]XML_Util-installed:1.3.0 [PEAR]PEAR-installed:1.10.1 WrotePEARsystemconfigfileat:/application/php5.6.24/etc/pear.conf Youmaywanttoadd:/application/php5.6.24/lib/phptoyourphp.iniinclude_path /tools/php-5.6.24/build/shtoolinstall-cext/phar/phar.phar/application/php5.6.24/bin ln-s-fphar.phar/application/php5.6.24/bin/phar InstallingPDOheaders:/application/php5.6.24/include/php/ext/pdo/ [root@centos02php-5.6.24]#ln-s/application/php5.6.24//application/php [root@centos02php-5.6.24]#cpphp.ini-production/application/php/lib/php.ini [root@centos02php-5.6.24]#cd/application/php/etc/ [root@centos02etc]#cpphp-fpm.conf.defaultphp-fpm.conf [root@centos02etc]#catphp-fpm.conf [global] [www] user=nginx group=nginx listen=127.0.0.1:9000 pm=dynamic pm.max_children=5 pm.start_servers=2 pm.min_spare_servers=1 pm.max_spare_servers=3 [root@centos02etc]#/application/php/sbin/php-fpm nginx配置如下 [root@centos02etc]#cat/application/nginx/conf/nginx.conf worker_processes2; events{ worker_connections1024; } http{ log_formatmain'$remote_addr-$remote_user[$time_local]"$request"' '$status$body_bytes_sent"$http_referer"' '"$http_user_agent""$http_x_forwarded_for"'; includemime.types; default_typeapplication/octet-stream; sendfileon; keepalive_timeout65; server{ listen80; server_namewww.martin.commartin.com; location/{ roothtml/www; indexindex.phpindex.htmlindex.htm; } location~.*\.(php|php5)?${ roothtml/www; fastcgi_pass127.0.0.1:9000; fastcgi_indexindex.php; includefastcgi.conf; } access_loglogs/access_www.logmain; } server{ listen80; server_namebbs.martin.com; location/{ roothtml/bbs; indexindex.phpindex.htmlindex.htm; } location~.*\.(php|php5)?${ fastcgi_pass127.0.0.1:9000; fastcgi_indexindex.php; includefastcgi.conf; } access_loglogs/access_bbs.logmain; } ###status server{ listen80; server_namestatus.martin.org; location/{ stub_statuson; access_logoff; } } } 浏览器访问测试 (www.martin.com---172.16.80.117) 至此整个LNMP环境准备完成,zabbix(在LNMP环境下)选择源码编译安装 curl 7.19.7 系统默认版本,升级该软件版本,否则后面邮件功能会有问题 [root@centos02application]#rpm-Uvhhttp://www.city-fan.org/ftp/contrib/yum-repo/rhel6/x86_64/city-fan.org-release-1-13.rhel6.noarch.rpm Retrievinghttp://www.city-fan.org/ftp/contrib/yum-repo/rhel6/x86_64/city-fan.org-release-1-13.rhel6.noarch.rpm warning:/var/tmp/rpm-tmp.jSwm5A:HeaderV3DSA/SHA1Signature,keyIDb56a8bac:NOKEY Preparing...###########################################[100%] 1:city-fan.org-release###########################################[100%] [root@centos02application]#yuminstalllibcurl-y [root@centos02application]#curl-V再次查看版本 curl7.50.1(x86_64-redhat-linux-gnu)libcurl/7.50.1OpenSSL/1.0.1ezlib/1.2.3c-ares/1.11.0libidn/1.18libssh2/1.7.0nghttp2/1.6.0 Protocols:dictfileftpftpsgopherhttphttpsimapimapsldapldapspop3pop3srtspscpsftpsmbsmbssmtpsmtpstelnettftp Features:AsynchDNSIDNIPv6LargefileGSS-APIKerberosSPNEGONTLMNTLM_WBSSLlibzHTTP2UnixSocketsMetalink 安装zabbix依赖包 [root@centos02zabbix-3.0.4]#yum-yinstallmysql-devellibxml2-develnet-snmp-devellibcurl-devel [root@centos02tools]#wgethttp://ncu.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.4/zabbix-3.0.4.tar.gz [root@centos02tools]#tarxfzabbix-3.0.4.tar.gz [root@centos02tools]#cdzabbix-3.0.4 [root@centos02zabbix-3.0.4]#./configure--prefix=/application/zabbix-server--enable-server--with-mysql--with-net-snmp--with-libcurl--with-libxml2--enable-agent--enable-proxy Enableserver:yes Serverdetails: Withdatabase:MySQL WEBMonitoring:cURL NativeJabber:no SNMP:yes IPMI:no SSH:no TLS:no ODBC:no Linkerflags:-L/usr/lib64/mysql-L/usr/lib64-rdynamic Libraries:-lmysqlclient-lxml2-lnetsnmp-lcurl-lm-ldl-lrt-lresolv Enableproxy:yes Proxydetails: Withdatabase:MySQL WEBMonitoring:cURL SNMP:yes IPMI:no SSH:no TLS:no ODBC:no Linkerflags:-L/usr/lib64/mysql-L/usr/lib64-rdynamic Libraries:-lmysqlclient-lxml2-lnetsnmp-lcurl-lm-ldl-lrt-lresolv Enableagent:yes Agentdetails: TLS:no Linkerflags:-rdynamic Libraries:-lcurl-lm-ldl-lrt-lresolv EnableJavagateway:no LDAPsupport:no IPv6support:no *********************************************************** *Nowrun'makeinstall'* ** *ThankyouforusingZabbix!* *<http://www.zabbix.com>* *********************************************************** [root@centos02 zabbix-3.0.4]# make install 由于zabbix启动脚本路径默认指向的是/usr/local/sbin路径,因此,需要提前建立软链接 [root@centos02zabbix-3.0.4]#ln-s/application/zabbix-server/sbin/*/usr/local/sbin/ [root@centos02zabbix-3.0.4]#ln-s/application/zabbix-server/bin/*/usr/local/bin/ 生成zabbix的web文件 [root@centos02zabbix-3.0.4]#mkdir/application/nginx/html/zabbix [root@centos02zabbix-3.0.4]#cp-a/tools/zabbix-3.0.4/frontends/php/*/application/nginx/html/zabbix/ 手动创建zabbix数据库及授权 [root@centos02zabbix-3.0.4]#mysql-uroot-p123456 WelcometotheMySQLmonitor.Commandsendwith;or\g. YourMySQLconnectionidis4 Serverversion:5.5.49-logMySQLCommunityServer(GPL) Copyright(c)2000,2013,Oracleand/oritsaffiliates.Allrightsreserved. OracleisaregisteredtrademarkofOracleCorporationand/orits affiliates.Othernamesmaybetrademarksoftheirrespective owners. Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement. mysql>createdatabasezabbixdefaultcharsetutf8; QueryOK,1rowaffected(0.16sec) mysql>grantallonzabbix.*tozabbix@'localhost'identifiedby'zabbix'; QueryOK,0rowsaffected(0.16sec) mysql>flushprivileges; QueryOK,0rowsaffected(0.19sec) 导入zabbix数据库文件 [root@centos02mysql]#pwd /tools/zabbix-3.0.4/database/mysql [root@centos02mysql]#mysql-uzabbix-pzabbixzabbix<schema.sql [root@centos02mysql]#mysql-uzabbix-pzabbixzabbix<p_w_picpaths.sql [root@centos02mysql]#mysql-uzabbix-pzabbixzabbix<data.sql 配置zabbixserver端 修改zabbix配置文件,配置zabbix_server cd/usr/local/zabbix/etc vi/usr/local/zabbix/etc/zabbix_server.conf DBName=zabbix#数据库名称 DBUser=zabbix#数据库用户名 DBPassword=zabbix#数据库密码 ListenIP=localhost#数据库ip地址 DBSocket=/tmp/mysql.sock#这里填写mysql实际的socket位置查看/etc/my.cnf即可 AlertScriptsPath=/application/zabbix-server/share/zabbix/alertscripts#zabbix运行脚本存放目录 修改php.ini文件/application/php/lib/php.ini post_max_size=16M max_execution_time=300 memory_limit=128M max_input_time=300 date.timezone=Asia/Shanghai always_populate_raw_post_data=-1 extension=php_gettext.dll 修改nginx配置文件如下 [root@centos02mysql]#cat/application/nginx/conf/nginx.conf worker_processes2; events{ worker_connections1024; } http{ log_formatmain'$remote_addr-$remote_user[$time_local]"$request"' '$status$body_bytes_sent"$http_referer"' '"$http_user_agent""$http_x_forwarded_for"'; includemime.types; default_typeapplication/octet-stream; sendfileon; keepalive_timeout65; server{ listen80; server_namewww.martin.commartin.com; location/{ roothtml/zabbix; indexindex.phpindex.htmlindex.htm; } location~.*\.(php|php5)?${ roothtml/zabbix; fastcgi_pass127.0.0.1:9000; fastcgi_indexindex.php; includefastcgi.conf; } access_loglogs/access_zabbix.logmain; } server{ listen80; server_namebbs.martin.com; location/{ roothtml/bbs; indexindex.phpindex.htmlindex.htm; } location~.*\.(php|php5)?${ fastcgi_pass127.0.0.1:9000; fastcgi_indexindex.php; includefastcgi.conf; } access_loglogs/access_bbs.logmain; } ###status server{ listen80; server_namestatus.martin.org; location/{ stub_statuson; access_logoff; } } } [root@centos02mysql]#/application/nginx/sbin/nginx-sreload [root@centos02mysql]#useradd-s/sbin/nologin-Mzabbix [root@centos02mysql]#/etc/init.d/zabbix_serverstart Startingzabbix_server:[OK] [root@centos02mysql]#/application/php/sbin/php-fpm [root@centos02init.d]#/application/zabbix-server/sbin/zabbix_server-c/application/zabbix-server/etc/zabbix_server.conf 浏览器访问http://www.martin.com/ 用户名/密码 默认是 Admin/zabbix 再来看下中文界面 安装agent [root@centos02tools]#wgethttp://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm [root@centos02tools]#rpm-ivhzabbix-release-3.0-1.el6.noarch.rpm Preparing...###########################################[100%] 1:zabbix-release###########################################[100%] [root@centos02tools]#yum-yinstallzabbix-agent [root@centos02tools]#/etc/init.d/zabbix-agentstart启动agent StartingZabbixagent:[OK] 按照图示步骤启用主机监控即可 这次我们简单介绍到这里,下篇我们正式开始介绍zabbix监控

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册