LNMP:LNMP是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写。L指Linux,N指Nginx,M一般指MySQL,也可以指MariaDB,P一般指PHP,也可以指Perl或Python。
![29ca63582c2a7ce8e7d70d2518a18317.png](https://i-blog.csdnimg.cn/blog_migrate/df28d522dd69b356d5638b10249d8e92.jpeg)
进过前面三小节,我们已经初步搭建完成了LNMP基础架构了,但是有些小伙伴想确认下环境是否确认搭建无误,那么我们接下来就验证一下环境的准确性。
1、在nginx目录下,新建测试文件
[root@one nginx]# cd /home/nginx/[root@one nginx]# touch html/huaxin_mysql.php[root@one nginx]# ls html/50x.html index.html huaxin_mysql.php test.php[root@one nginx]#
2、在 huaxin_mysql.php 中写入我们的测试信息
[root@one nginx]# vim html/huaxin_mysql.php# 写入信息<?php $link=mysql_connect("192.168.20.128:3316","huaxin","Nihao@123456"); if(!$link){ echo "mysql_connect fail"; }else{ echo "mysql_connect success"; }?> # 保存退出 :wq[root@one nginx]#
添加内容如图:
![1017f35add581bd322f47c6fe1707cc2.png](https://i-blog.csdnimg.cn/blog_migrate/6d26b2da255a38bd438405f3e77150f5.jpeg)
添加的内容解读:
使用 mysql 用户名 “huaxin” 密码 “Nihao@123456” 连接数据库 “192.168.20.128”;
如果成功就返回 “mysql_connect success” ;
如果失败就返回 “mysql_connect fail”;
3、重新加载nginx
PS:每次重启nginx之前,最好先检查下配置文件的准确性
[root@one nginx]# ./sbin/nginx -tnginx: the configuration file /home/nginx//conf/nginx.conf syntax is oknginx: configuration file /home/nginx//conf/nginx.conf test is successful[root@one nginx]# ./sbin/nginx -s reload[root@one nginx]#
4、浏览器访问进行验证
输入地址:http://192.168.20.128:8010/huaxin_mysql.php
此处的IP地址要换成你本地实际的IP地址
![9428c362bc11adabcc8de2875f1f277b.png](https://i-blog.csdnimg.cn/blog_migrate/f41a7560323d230b8c373f8b06e048a7.jpeg)
至此,就可以证明我们LNMP架构整体搭建完成,接下来开启第二章:Zabbix安装,继续加油~