LNMP架构部署zabbix监控
- 环境:CentOS7
- VMware虚拟机
一:LNMP之Nginx服务器编译安装
1.安装nginx依赖:
yum -y install wget gcc gcc-c++ make pcre pcre-devel zlib-devel zlib openssl openssl-devel
2.上传nginx压缩包
/usr/local/src
3.解压nginx
tar -zxvf nginx-1.6.0.tar.gz
4.进入解压后的目录下
cd nginx-1.6.0/
5.安装configure到/usr/local/nginx
./configure --prefix=/usr/local/nginx #先进行检查是否符合安装环境
6.执行安装
make && make install
二:手动启动和关闭nginx
1.改环境变量:
vi /etc/profile
export PATH=$PATH:/usr/local/nginx/sbin/ #加入到配置文件最后,可直接使用nginx -v查看nginx版本信息
source /etc/profile #使配置文件生效
2.nginx配置文件
nginx -t
#回显以下内容则证明nginx配置文件正常
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax
is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test
is successful
3.启动nginx
nginx
4.检查nginx进程
ps auxfww | grep nginx

5.检查nginx监听端口80
netstat -tulnp|grep nginx

6.验证nginx是否安装成功:
1.浏览器访问IP+端口,出现welcometo nginx页面则证明nginx安装成功

三,使用systemctl管理nginx,/usr/lib/systemd/system/nginx.service
#nginx.service中的nginx为服务类型,若使用php服务咋改为php.service
1.pkill nginx #杀掉nginx进程
2. vi /usr/lib/systemd/system/nginx.service
内容:
[Unit]
Description=nginx #代表了服务
After=network.target
[Service]
Type=fprking
ExecStart=/usr/local/nginx/sbin/nginx
[Install]
WantedBy=multi-user.target
3.启动nginx
systemctl start nginx
四:LNMP之PHP源码编译安装
1.安装php所需的依赖包
yum -y install epel-release
yum -y install gcc gcc-c++ make pcre pcre-devel zlib-devel openssl openssl-devel libxml2 libxml2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel openldap openldap-devel libmcrypt libmcrypt-devel
2.上传压缩包
cd /usr/local/src
tar -zxf php-8.1.0.tar.gz
cd php-8.1.0/
3.PHP安装环境编译
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=wwww --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mastring --enable-intl --with-mcrypt --with-libmbfl --enable-ftp --with-gd --enable-gd-jis-conv --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext -disable-fileinfo --enable-opcache --with-pear --enable-maintainer-zts --with-ldap=shared --without-gdbm

本文详细介绍LNMP(Linux+Nginx+MySQL+PHP)环境的搭建步骤,并完成Zabbix监控系统的安装配置。涵盖Nginx、PHP、MySQL的安装与配置流程,以及Zabbix的编译安装和数据库初始化。
最低0.47元/天 解锁文章
3324

被折叠的 条评论
为什么被折叠?



