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

Construction and deployment of Zabbix platform based on rhel7.2 (1)

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Construction and deployment of zabbix platform based on rhel7.2 (1)

First, the experimental environment:

(1) Virtual machine: rhel7.2 x86room64

(2) Database: mysql5.7.13

(3) nginx1.10.2

(4) PHP5.6.27

(5) zabbix3.2.3

Install compilation tools and library files

[root@localhost ~] # yum-y install make apr* autoconf automake curl-devel gcc gcc-c++ openssl openssl-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* libtool* libxml2 libxml2-devel patch libcurl-devel bzip2-devel freetype-devel

Third, install mysql5.7.13

(1) for specific installation steps, please refer to my blog: http://wutengfei.blog.51cto.com/10942117/1931482

(2) after mysql is installed, take a look at mysql's service.

[root@localhost ~] # ps-ef | grep mysql

[root@localhost ~] # netstat-lnp | grep mysql

(3) exception of port 3306 enabled by firewall

[root@localhost] # firewall-cmd-- permanent-- add-port=3306/tcp

Success

[root@localhost] # firewall-cmd-- reload

Success

(4) Database password: 123456

Fourth, install nginx1.10.2

(1) decompress zlib and pcre

[root@localhost src] # tar-zxvf zlib-1.2.8.tar.gz

[root@localhost src] # tar-zxvf pcre-8.39.tar.gz

Description: there is no need to compile, just decompress it.

(2) create group accounts and user accounts

[root@localhost ~] # groupadd www

[root@localhost] # useradd-g www-s / sbin/nologin www

[root@localhost ~] # grep www / etc/passwd

Www:x:1000:1000::/home/www:/sbin/nologin

(3) download and install nginx

[root@localhost src] # tar-zxvf nginx-1.10.3.tar.gz

[root@localhost src] # cd nginx-1.10.3

[root@localhost nginx-1.10.3] # / configure-- prefix=/usr/local/nginx1.10-- with-http_dav_module-- with-http_stub_status_module-- with-http_addition_module-- with-http_sub_module-- with-http_flv_module-- with-http_mp4_module-- with-pcre=/usr/src/pcre-8.39-- with-zlib=/usr/src/zlib-1.2.8-- with- Http_ssl_module-with-http_gzip_static_module-user=www-group=www & & make & & make install

(4) make soft links

[root@localhost nginx-1.10.3] # ln-s / usr/local/nginx1.10/sbin/nginx / usr/local/sbin/

(5) nginx syntax checking

[root@localhost nginx-1.10.3] # nginx- t

(6) start nginx and view the service

[root@localhost nginx-1.10.3] # netstat-lnp | grep nginx

(7) exception of port 80 enabled by firewall

[root@localhost] # firewall-cmd-- permanent-- add-port=80/tcp

Success

[root@localhost] # firewall-cmd-- reload

Success

(8) access testing on a client

5. Install php5.6.27

(1) install libmcrypt

[root@localhost src] # tar-zxvf libmcrypt-2.5.7.tar.gz

[root@localhost src] # cd libmcrypt-2.5.7

[root@localhost libmcrypt-2.5.7] # / configure & & make & & make install

(2) make soft links

[root@localhost] # ln-s / usr/local/mysql/lib/libmysqlclient.so.20.3.0 / usr/local/mysql/lib/libmysqlclient_r.so

(3) install php

[root@localhost src] # tar-zxvf php-5.6.27.tar.gz

[root@localhost src] # cd php-5.6.27

[root@localhost php-5.6.27] # / configure-- prefix=/usr/local/php5.6-- with-config-file-path=/etc-- with-mysql=/usr/local/mysql-- with-mysqli=/usr/local/mysql/bin/mysql_config-- with-mysql-sock=/usr/local/mysql/mysql.sock-- with-gd-- with-iconv-- with-libxml-dir=/usr-- with-mhash-- with-mcrypt-- with-config-file -scan-dir=/etc/php.d-- with-bz2-- with-zlib-- with-freetype-dir-- with-png-dir-- with-jpeg-dir-- enable-bcmath-- enable-shmop-- enable-sysvsem-- enable-inline-optimization-- enable-mbregex-- enable-fpm-- enable-mbstring-- enable-ftp-- enable-gd-native-ttf-with-openssl-- enable-pcntl-- enable-sockets-- with-xmlrpc-- enable -zip-enable-soap-- without-pear-- with-gettext-- enable-session-- with-mcrypt--with-curl & & make & & make install

(4) copy the sample configuration file and modify it

[root@ php-5.6.27] # cp php.ini-production / etc/php.ini

[root@ php-5.6.27] # vim / etc/php.ini

Modify the following in the / etc/php.ini configuration file:

/ / set time zone

/ / suppress the display of php version information

/ / support php short tags

/ / upload file size

/ / maximum execution time of php script

/ / limit the time of receiving data by POST, GET and PUT in seconds

(5) create a php-fpm service startup script

[root@ php-5.6.27] # cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm

[root@ php-5.6.27] # chmod + x / etc/init.d/php-fpm

[root@ php-5.6.27] # chkconfig-- add php-fpm

[root@ php-5.6.27] # chkconfig php-fpm on

[root@ php-5.6.27] # chkconfig-- list | grep php

Note: This output shows SysV services only and does not include native

Systemd services. SysV configuration data might be overridden by native

Systemd configuration.

If you want to list systemd services use 'systemctl list-unit-files'.

To see services enabled on particular target use

'systemctl list-dependencies [target]'.

Php-fpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off

(6) provide php-fpm configuration file and edit

[root@ php-5.6.27] # cp / usr/local/php5.6/etc/php-fpm.conf.default / usr/local/php5.6/etc/php-fpm.conf

[root@ php-5.6.27] # vim / usr/local/php5.6/etc/php-fpm.conf

Modify the following in the configuration file:

(7) start the php-fpm service and view

[root@ ~] # service php-fpm start

Starting php-fpm done

[root@ ~] # netstat-lnp | grep php-fpm

Tcp 00 127.0.0.1 maste 9000 0.0.0.0 maste * maste

Configure nginx to support php

[root@ ~] # vim / usr/local/nginx1.10/conf/nginx.conf

User www www

Worker_processes 4

# error_log logs/error.log

# error_log logs/error.log notice

# error_log logs/error.log info

# pid logs/nginx.pid

Events {

Worker_connections 1024

}

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

Sendfile on

# tcp_nopush on

# keepalive_timeout 0

Keepalive_timeout 65

# gzip on

Server {

Listen 80

Server_name localhost

Charset utf-8

# access_log logs/host.access.log main

Location / {

Root html

Index index.php index.html index.htm

}

# error_page 404 / 404.html

# redirect server error pages to the static page / 50x.html

#

Error_page 500 502 503 504 / 50x.html

Error_page 500 502 503 504 / 50x.html

Location = / 50x.html {

Root html

}

Location / ststus {

Stub_status on

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

# location ~\ .php$ {

# proxy_pass http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

Location ~\ .php$ {

Root html

Fastcgi_pass 127.0.0.1:9000

Fastcgi_index index.php

# fastcgi_param SCRIPT_FILENAME / scripts$fastcgi_script_name

Include fastcgi.conf

}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

# location ~ /\ .ht {

# deny all

#}

}

# another virtual host using mix of IP-, name-, and port-based configuration

#

# server {

# listen 8000

# listen somename:8080

# server_name somename alias another.alias

# location / {

# root html

# index index.html index.htm

#}

#}

# HTTPS server

#

# server {

# listen 443 ssl

# server_name localhost

# ssl_certificate cert.pem

# ssl_certificate_key cert.key

# ssl_session_cache shared:SSL:1m

# ssl_session_timeout 5m

# ssl_ciphers HIGH:!aNULL:!MD5

# ssl_prefer_server_ciphers on

# location / {

# root html

# index index.html index.htm

#}

#}

}

[root@ ~] # nginx-t

Nginx: the configuration file / usr/local/nginx1.10/conf/nginx.conf syntax is ok

Nginx: configuration file / usr/local/nginx1.10/conf/nginx.conf test is successful

[root@ ~] # nginx

[root@ ~] # netstat-lnp | grep nginx

Tcp 0 0 0.0.0 0 master 80 0.0.0 0. 0. 0 master

7. Test LNMP

(1) enter the default web page root directory of nginx and create a test page of test.php:

[root@ ~] # vim / usr/local/nginx1.10/html/test1.php

[root@ ~] # vim / usr/local/nginx1.10/html/test2.php

(2) Test on the client

There are two ways:

Method 1: use the curl command

[root@ ~] # curl localhost/test1.php

PHP parsing is normal.

[root@ ~] # curl localhost/test2.php

Ok

Method 2: use a browser

This is the LNMP deployment process!

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

Servers

Wechat

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

12
Report