配置说明
(让nginx MySQL(中间件)之间建立关系) 第一个里程: 编写nginx.php首页文件 第二个里程:重启nginx 第三个里程:访问网页测试 打开浏览器访问:http://47.108.58.170 |
#1、准备环境,下载依赖软件
第一个里程: 编写nginx.php首页文件 [root@TEST php-7.2.29]# vim /application/nginx/html/index.php <?php #Create connection $conn = new mysqli("127.0.0.1", "root", "F@m321520379"); #Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully"; ?> 说明:https://blog.csdn.net/u012313382/article/details/90707741
#2、:重启nginx
[root@TEST php-7.2.29]# /application/nginx/sbin/nginx -s stop
[root@TEST php-7.2.29]# /application/nginx/sbin/nginx -t
nginx: the configuration file /application/nginx-1.4.0/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.4.0/conf/nginx.conf test is successful
[root@TEST php-7.2.29]# /application/nginx/sbin/nginx
#3、访问网页测试
浏览器访问:http://47.108.58.170
显示:Connected successfully ;代表配置成功。