{"id":248,"date":"2018-07-05T16:32:22","date_gmt":"2018-07-05T08:32:22","guid":{"rendered":"https:\/\/blog.bilicloud.com\/?p=248"},"modified":"2018-07-05T16:32:22","modified_gmt":"2018-07-05T08:32:22","slug":"zabbixnginxphp7-0debian9%e7%9a%84%e9%83%a8%e7%bd%b2%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/blog.foxsar.black\/?p=248","title":{"rendered":"zabbix+nginx+php7.0+debian9\u7684\u90e8\u7f72\u65b9\u6cd5"},"content":{"rendered":"<p>\t\t\t\tRT \u5b98\u65b9\u5efa\u8baeapache2\uff0c\u7136\u800c\u5e76\u4e0d\u60f3\u7528apache2<br \/>\n\u6570\u636e\u5e93\u4fdd\u6301\u4f7f\u7528MySql\uff0c\u91cf\u5c0f\u6682\u65f6\u6ca1\u6709PostgreSQL\u7684\u9700\u6c42<br \/>\n\u4f9d\u65e7\u662froot\u8d26\u53f7\uff0c\u6240\u4ee5\u4e0d\u5e26sudo<\/p>\n<p>1\u3001\u5b89\u88c5\u57fa\u7840<br \/>\n\u8fd9\u91cc\u6bd4\u8f83\u5077\u61d2\u5c31\u76f4\u63a5apt\u88c5nginx\u4e86\uff0c\u6709\u7248\u672c\u9700\u6c42\u81ea\u884c\u7f16\u8bd1\uff0capt\u88c5\u597d\u7684nginx config\u5728\/etc\/nginx\u4e0b\u9762\uff0c\u8bf7\u6ce8\u610f<\/p>\n<pre>apt-get update\napt-get install nginx php7.0-fpm php7.0-mysql mysql-server<\/pre>\n<p>\u88c5\u5b8c\u5148\u653e\u7740<\/p>\n<p>2\u3001\u5b89\u88c5zabbix-server\u548canget\uff08\u53ef\u9009\uff09<\/p>\n<pre>wget http:\/\/repo.zabbix.com\/zabbix\/3.4\/debian\/pool\/main\/z\/zabbix-release\/zabbix-release_3.4-1%2Bstretch_all.deb\ndpkg -i zabbix-release_3.4-1+stretch_all.deb\napt-get update\napt-get install zabbix-server-mysql zabbix-frontend-php zabbix-agent<\/pre>\n<p>\u5b89\u88c5\u5b8c\u540e\u53ef\u80fd\u4f1a\u628aapache2\u4e5f\u7ed9\u4f60\u88c5\u4e0a\u4e86\uff0c\u5220\u4e86\u5220\u4e86<\/p>\n<pre>systemctl stop apache2.service\napt-get remove apache2\napt autoremove<\/pre>\n<p>\u7136\u540e\u7ee7\u7eed\u653e\u7740<\/p>\n<p>3\u3001\u914d\u7f6e\u6570\u636e\u5e93<\/p>\n<pre>mysql -uroot -p\ncreate database zabbix character set utf8 collate utf8_bin;\ngrant all privileges on zabbix.* to zabbix@localhost identified by '***YOURPASSWORD***';\nquit;\ncd \/usr\/share\/doc\/zabbix-server-mysql\nzcat create.sql.gz | mysql -uzabbix -p zabbix<\/pre>\n<p>\u914d\u7f6ezabbix-server\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u5bfc\u5165\u521d\u59cb\u67b6\u6784\u6570\u636e<br \/>\nmysql\u7684root\u7684\u5bc6\u7801\u9ed8\u8ba4\u8ddf\u968f\u7cfb\u7edf\u7684root\u5bc6\u7801\uff0c\u800c\u4e0d\u518d\u662f\u5b89\u88c5\u7684\u65f6\u5019\u53e6\u5916\u8bbe\u7f6e\u4e86<\/p>\n<p>4\u3001\u914d\u7f6enginx\u548cphp-fpm<\/p>\n<pre>vim \/etc\/nginx\/sites-enabled\/zabbix.conf\n\nserver {\n       listen 80;\n        server_name  localhost;\n        root   \/usr\/share\/zabbix;\n\n\n        location \/ {\n                index  index.html index.htm index.php;\n        }\n        error_page   500 502 503 504  \/50x.html;\n        location = \/50x.html {\n                root   \/usr\/share\/nginx\/html;\n        }\n        location ~ \\.php$ {\n                include snippets\/fastcgi-php.conf;\n                fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\n                include        fastcgi_params;\n        }\n}<\/pre>\n<p>php-fpm\u5728apt\u5b89\u88c5\u7684\u60c5\u51b5\u4e0b\u9ed8\u8ba4\u5c31\u7528\u7684sock\uff0c\u6240\u4ee5\u4e0d\u7528\u6539\u52a8\uff0c\u5982\u679c\u662f\u5176\u4ed6\u5b89\u88c5\u65b9\u6cd5\u7684\u8bdd\u8bf7\u81ea\u884c\u68c0\u67e5\u548c\u4fee\u6539<\/p>\n<pre>vim \/etc\/php\/7.0\/fpm\/php.ini\n\nmax_execution_time = 300\nmax_input_time = 600\npost_max_size = 32M\ndate.timezone = Asia\/Tokyo\n\n\u4ee5\u4e0a4\u6761\u8bf7\u7528\u641c\u7d22\u529f\u80fd\u5bfb\u627e\u5e76\u4fee\u6539<\/pre>\n<p>5\u3001\u914d\u7f6ezabbix-server\u548cagent<\/p>\n<pre>vim \/etc\/zabbix\/zabbix_server.conf\n\nDBHost=\nDBName=\nDBPassword=<\/pre>\n<p>\u4ee5\u4e0a3\u6761\u8bf7\u81ea\u884c\u641c\u7d22\u5e76\u4fee\u6539<\/p>\n<pre>vim \/etc\/zabbix\/zabbix_agentd.conf\n\nServer=\nHostname=\n<\/pre>\n<p>\u4ee5\u4e0a2\u6761\u8bf7\u81ea\u884c\u641c\u7d22\u5e76\u4fee\u6539<\/p>\n<p>6\u3001\u5f00\u673a\u81ea\u52a8\u542f\u52a8\u548c\u542f\u52a8\u670d\u52a1\u5e76\u8bbf\u95ee<\/p>\n<pre>systemctl enable nginx\nsystemctl enable php7.0-fpm\nsystemctl enable mysql\nsystemctl enable zabbix-server\nsystemctl enable zabbix-agent\nsystemctl restart nginx\nsystemctl restart php7.0-fpm\nsystemctl restart mysql\nsystemctl restart zabbix-server\nsystemctl restart zabbix-agent<\/pre>\n<p>\u5199\u7684\u6bd4\u8f83\u7cd9\uff0c\u6709\u4e9b\u53ef\u80fd\u662f\u9700\u8981restart<\/p>\n<p>\u7136\u540e\u6253\u5f00\u6d4f\u89c8\u5668\uff0chttp:\/\/yourdomain\/setup.php \u8fdb\u5165zabbix\u7684\u914d\u7f6e\u9875\u9762\uff0c\u5269\u4e0b\u7684\u8ddf\u7740\u6d41\u7a0b\u8d70\u4e00\u904d\u5373\u53ef~<\/p>\n<p>PS\uff1a\u521d\u59cb\u8d26\u53f7\u5bc6\u7801\u662f Admin\u548czabbix\uff08\u8d26\u53f7\u6ce8\u610f\u5927\u5c0f\u5199\uff09<\/p>\n<p>\u53c2\u8003\u8d44\u6599\uff1a<br \/>\n<a href=\"https:\/\/www.zabbix.com\/documentation\/3.4\/zh\/manual\/installation\/install_from_packages#from_distribution_packages\" target=\"_blank\" rel=\"noopener noreferrer\">\u4ece\u90e8\u7f72\u5305\u5b89\u88c5 Zabbix Documentation 3.4<\/a><br \/>\n<a href=\"https:\/\/qiita.com\/hinoshiba\/items\/c9a89472245b53cf2394\" target=\"_blank\" rel=\"noopener noreferrer\">ubuntu16.04 + ZABBIX + nginx &amp; php-fpm<\/a>\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RT \u5b98\u65b9\u5efa\u8baeapache2\uff0c\u7136\u800c\u5e76\u4e0d\u60f3\u7528apache2 \u6570\u636e\u5e93\u4fdd\u6301\u4f7f\u7528MySql\uff0c\u91cf\u5c0f\u6682\u65f6\u6ca1\u6709Postgre &hellip; <a href=\"https:\/\/blog.foxsar.black\/?p=248\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">zabbix+nginx+php7.0+debian9\u7684\u90e8\u7f72\u65b9\u6cd5<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[13,32,33,37,53],"class_list":["post-248","post","type-post","status-publish","format-standard","hentry","category-2","tag-debian","tag-mysql","tag-nginx","tag-php","tag-zabbix"],"_links":{"self":[{"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/posts\/248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=248"}],"version-history":[{"count":0,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/posts\/248\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}