Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The process of installing and configuring nginx, mysql and zabbix under CentOS

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "the process of installing and configuring nginx, mysql and zabbix under CentOS". In the daily operation, I believe that many people have doubts about the process of installing and configuring nginx, mysql and zabbix under CentOS. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "the process of installing and configuring nginx, mysql and zabbix under CentOS". Next, please follow the editor to study!

Environment:

Operating system: CentOS 6.8 x86x64 (turn off SELinux, iptables)

Nginx:1.10.1

PHP: 7.0.10

MySQL:5.7.13

Zabbix:3.0.4

one。 Install MySQL

1. Installation dependency

Yum-y install gcc gcc-devel gcc-c++ gcc-c++-devel libaio-devel boost boost-devel autoconf* automake* zlib* libxml* ncurses-devel ncurses libgcrypt* libtool* cmake openssl openssl-devel bison bison-devel unzip numactl-devel net-snmp-devel net-snmp-utils

two。 Uninstall mysql-libs, otherwise there will be an error when installing mysql below

Rpm-e-nodeps mysql-libs

3. Download, decompress and install

Wget tar xf mysql-5.7.13-1.el6.x86_64.rpm-bundle.tarrpm-ivh `ls | grep mysql-community | grep-v test`

4. Because mysql 5.7is much more secure than the previous 5.6, there are many differences

Reset the password first

# modify the default character set sed-I'/\ [mysqld\] / a\ character-set-server=utf8' my.cnf# to start mysqld and initialize / etc/init.d/mysqld start# to stop mysqld For password-less startup / etc/init.d/mysqld stop# password-less startup mysqlmysqld_safe-- skip-grant-tables & mysql# Note the new version of mysql 5.7 has no password field under the mysql.user table mysql > update mysql.user set authentication_string=password ('123456.abcd') where user='root' and Host =' localhost' ERROR 1819 (HY000): Your password does not satisfy the current policy requirements# will be told that your password does not conform to the current policy # modify the corresponding password policy, but the password should be at least 9 digits mysql > set global validate_password_policy=0;mysql > update mysql.user set authentication_string=password ('123456.abcd') where user='root' and Host =' localhost';service mysqld restart

two。 Compile and install PHP 7.0.10

1. Install the EPEL source and install the corresponding dependency package

Rpm-ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpmyum-y install libmcrypt-devel mcrypt mhash gd-devel ncurses-devel libxml2-devel bzip2-devel libcurl-devel curl-devel libjpeg-devel libpng-devel freetype-devel net-snmp-devel openssl-devel

two。 Install libiconv

Wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gztar zxf libiconv-1.14.tar.gzcd libiconv-1.14./configure-prefix=/usr/local/libiconv1.14make & & make installcd.

3. Download and compile php

Wget http://cn2.php.net/get/php-7.0.10.tar.gz/from/this/mirrortar zxf mirrorcd php-7.0.10/./configure-prefix=/usr/local/php7.0.10-with-config-file-path=/usr/local/php7.0.10/etc-enable-mysqlnd-with-mysqli=mysqlnd-with-pdo-mysql=mysqlnd-with-iconv-dir=/usr/local/libiconv1.14-with-pcre-regex-with- Zlib--with-bz2-enable-calendar-with-curl-enable-dba-with-libxml-dir-enable-ftp-with-gd-with-jpeg-dir-with-png-dir-with-zlib-dir-with-freetype-dir-enable-gd-native-ttf-with-mhash-enable-mbstring-with-mcrypt-enable-pcntl-enable-xml-disable-rpath-enable-shmop-enable-sockets-enable-zip -- enable-bcmath-- with-snmp-- disable-ipv6-- with-gettext-- enable-fpm-- with-fpm-user=www-- with-fpm-group=www-- with-openssl# note that you cannot have-- enable-gd-jis-conv parameter Otherwise, the graphics behind make & & make install are garbled.

4. Modify the corresponding parameters

Cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpmchmod + x / etc/init.d/php-fpmcp / usr/local/php7.1.0/etc/php-fpm.conf.default / usr/local/php7.1.0/etc/php-fpm.confcp php.ini-production / usr/local/php7.0.10/etc/php.ini# modify time zone sed-I's # Date.timezone = # date.timezone = PRC#g' / usr/local/php7.0.10/etc/php.ini# Hidden PHP version sed-I 's#expose_php = On#expose_php = Off#g' / usr/local/php7.0.10/etc/php.inicp / usr/local/php7.0.10/etc/php-fpm.d/www.conf.default / usr/local/php7.0.10/etc/php-fpm.d/www.confsed-I Rlimit_files = 1024#rlimit_files = 65535roomg' / usr/local/php7.0.10/etc/php-fpm.d/www.confsed-I's roommate listen.owner = www#listen.owner = www#g' / usr/local/php7.0.10/etc/php-fpm.d/www.confsed-I's accountabilitylisten.group = www#listen.group = www#g' / usr/local/php7.0.10/etc/php-fpm.d/www.confsed-I's # Listen.mode = 0660#listen.mode = 0660 μ g'/ usr/local/php7.0.10/etc/php-fpm.d/www.confsed-I 's#listen = 127.0.0.1 usr/local/php7.0.10/etc/php-fpm.d/www.confsed 9000 brigade = 127.0.0.1 usr/local/php7.0.10/etc/php-fpm.d/www.confsed-I' / Listen = 127.0.0.1 usr/local/php7.0.10/etc/php-fpm.d/www.conf# 9000Universe a\ listen = / tmp/php-fpm.sock' / usr/local/php7.0.10/etc/php-fpm.d/www.conf# Security configuration, disable related functions, be careful not to include scandir and fsockopen,zabbix need to use these two functions sed-I's # ^ Cgi.fix_pathinfo=1#cgi.fix_pathinfo=0#g' / usr/local/php7.0.10/etc/php.inised-I 's#disable_functions = # disable_functions = exec,system,eval,passthru,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,fsocket,openlog,syslog,readlink,symlink,popepassthru Stream_socket_server#g' / usr/local/php7.0.10/etc/php.ini# restricted execution directory My WEB directory is all under / var/www/html sed-I's # Open_basedir = # open_basedir = "/ var/www/html/:/tmp/" # g' / usr/local/php7.0.10/etc/php.ini# modify the relevant parameters of PHP to ensure the minimum zabbix requirements sed-I 's#max_execution_time = 30#max_execution_time = 300 millig' / usr/local/php7.0.10/etc/php.inised-I' s#max_input_time = 60#max_input_time = 30 seconds G'/ usr/local/php7.0.10/etc/php.inised-I 's#post_max_size = 8M#post_max_size = 24Migg' / usr/local/php7.0.10/etc/php.inised-I' s#upload_max_filesize = 2M#upload_max_filesize = 4Migg' / usr/local/php7.0.10/etc/php.ini# modify php connection mysqlsed-I 's#pdo_mysql.default_socket=#pdo _ mysql.default_socket= / var/lib/mysql/mysql.sock#g' / usr/local/php7.0.10/etc/php.inised-I 's#mysqli.default_socket = # mysqli.default_socket = / var/lib/mysql/mysql.sock#g' / usr/local/php7.0.10/etc/php.ini add PHP executive user groupadd-g 10080 wwwuseradd-g www-u 10080-s / sbin/nologin-d / dev/null www

three。 Install Nginx

1. Download and install nginx

Wget http://nginx.org/download/nginx-1.10.1.tar.gztar zxf nginx-1.10.1.tar.gzcd nginx-1.10.1# Hidden Nginx version sed-I 'src/core/nginx.hsed-I' s # "nginx/" # "Apache/" # g 'src/core/nginx.hsed-I's # "Server: nginx" # "Server: Apache" # g'src / http/ngx_http_header_filter_module.csed-I-user=www-- group=www-- with-http_stub_status_module-- with-http_gzip_static_module-- with-http_ssl_modulemake & & make installsed-I 's#nginx/$nginx_version # Apache/$nginx_version;#g' / usr/local/nginx1.10.1/conf/fastcgi.conf

two。 Configure Nginx

Vim / usr/local/nginx1.10.1/conf/nginx.confuser www www;worker_processes 4 logs/error.log;pid logs/nginx.pid;worker_rlimit_nofile 65535 X events {use epoll; worker_connections 65535;} http {include mime.types; default_type application/octet-stream Log_format main'$remote_addr-$remote_user [$time_local] "$request"'$status $body_bytes_sent "$http_referer"'"$http_user_agent"$http_x_forwarded_for"; access_log logs/access.log main; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k Client_max_body_size 8m; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; fastcgi_param HTTP_PROXY "; # Hidden the relevant parameters of the backend server: proxy_hide_header Xmuri by; proxy_hide_header Xmurf ForwardedFort; proxy_hide_header X-AspNet-Version Proxy_hide_header Xmura proxy_hide_header Server; gzip on; gzip_min_length version; proxy_hide_header Via; proxy_hide_header Xmuri Varnishi; gzip_buffers 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 5; gzip_disable "NetMvc [1-6]\.; gzip_types text/plain text/css text/xml application/javascript application/x-javascript; gzip_vary on; include host/*.conf;}

3. Configure the site

Mkdir / usr/local/nginx1.10.1/conf/hostvim / usr/local/nginx1.10.1/conf/host/zabbix.conf server {listen 80; server_name localhost zabbix; location / {root / var/www/html; index index.html index.htm index.php; error_page 500502 503 504 / 50x.html Location = / 50x.html {root html;} location ~\ .php$ {fastcgi_pass unix:/tmp/php-fpm.sock; fastcgi_index index.php; fastcgi_param HTTP_PROXY "; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}}

four。 Install Zabbix

1. Download and install zabbix

Yum-y install OpenIPMI-develwget http://120.52.73.47/nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.4/zabbix-3.0.4.tar.gztar-zxvf zabbix-3.0.4.tar.gzcd zabbix-3.0.4./configure-- prefix=/usr/local/zabbix3.0.4-- enable-server-- with-mysql-- with-net-snmp-- with-libxml2-with-libcurl-- with-openipmi-- enable-agentmake & & make installl

two。 Configure zabbix

Cp misc/init.d/fedora/core5/zabbix_server / etc/init.d/cp misc/init.d/fedora/core5/zabbix_agentd / etc/init.d/sed-I-A-I-I-A-A-B-B-I-A-B-A- Agentd#g' / etc/init.d/zabbix_agentd

3. Copy a WEB site

Mkdir / var/www/html/zabbixcp-rf frontends/php/* / var/www/html/zabbix

4.zabbix garbled graphics processing

Upload the C:\ Windows\ Fonts\ simkai.ttf font file of the Windows operating system to / var/www/html/zabbix/font. Prevent garbled

Sed-I 'sDejaVuSanssimkaiyogg' / var/www/html/zabbix/include/defines.inc.php

5. Use MySQL to create a zabbix database and authorize

Mysql-uroot-pmysql > create database zabbix character set utf8;mysql > grant all on zabbix.* to 'zabbix'@'localhost' identified by' zabbix.localhost'

6. Import database

Enter the zabbix-3.0.4 source file directory mysql-uroot-p zabbix

< database/mysql/schema.sqlmysql -uroot -p zabbix < database/mysql/data.sqlmysql -uroot -p zabbix < database/mysql/p_w_picpaths.sql 7.修改zabbix_server配置文件,以下是我的配置文件 egrep -v '^:|^#' /usr/local/zabbix3.0.4/etc/zabbix_server.conf|awk 'NF>

0'LogFile=/tmp/zabbix_server.logDBName=zabbixDBUser=zabbixDBPassword=zabbix.localhostStartPollers=10StartPingers=4StartDiscoverers=4JavaGateway=127.0.0.1JavaGatewayPort=10052StartJavaPollers=5StartVMwareCollectors=5VMwareFrequency=60VMwareCacheSize=8M

8. Then modify the configuration file under the zabbix web directory

Vim / var/www/html/zabbix3.0.4/conf/zabbix.conf.php

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report