2)在php服务器上创建映射查找目录,此目录可以和Web服务器的站点根目录不同,此处设置为相同
[root@localhost~]# mkdir -pv /www/fcgi-test/
4.启动服务
[root@localhost~]# systemctl start httpd.service
[root@localhost~]# systemctl status httpd.service
5.测试
(1)172.16.49.2/www/fcgi-test/index.html,并定义it is apache测试,在浏览器输入172.16.49.2/index.html
(2)172.16.49.3的映射代理目录下创建index.php,定义phpinfo()测试语句,在浏览器输入172.16.49.2/index.php
<?php phpinfo(); ?>
(3)在172.16.49.2下同上放置index.php,在浏览器输入172.16.49.2/index.php
此时服务器会将.php请求发往php服务器查找,未找到index.php文件
(4)在172.16.49.3映射目录下同上放置index.html,在浏览器输入172.16.49.2/index.html
在172.16.49.2上找不到静态文件index.html报错
四、MariaDB数据库配置测试
1.禁止反解主机名
[root@localhost~]# vim /etc/my.cnf
在[mysqld]段添加语句:skip_name_resolve = ON
2.启动服务
[root@localhost~]# systemctl start mariadb.server
3.授权可远程登录用户
[root@localhost~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current inputstatement.
MariaDB [(none)]> Grant ALL ON *.* TO 'root'@'172.16.%.%' IDENTIFIED BY 'xuding'
4.mariadb数据库远程连接
172.16.49.3上:[root@localhost ~]# mysql -uroot -h172.16.49.4 -pxuding
5.php和mariadb服务连接测试
在172.16.49.3php主机上创建index.php测试页,写入如下代码:
<?php
$conn = mysql_connect('172.16.49.4','root','xuding');
if($conn)
echo"OK";
else
echo"Failure";
?>