FCGI模式LAMP跨三主机搭建详解(3)

2)php服务器上创建映射查找目录,此目录可以和Web服务器的站点根目录不同,此处设置为相同

[root@localhost~]# mkdir -pv /www/fcgi-test/

  4.启动服务

[root@localhost~]# systemctl start httpd.service

[root@localhost~]# systemctl status httpd.service

wKioL1ad4H6CZfSFAAFqwn62r5Q300.png

  5.测试

     (1)172.16.49.2/www/fcgi-test/index.html,并定义it is apache测试,在浏览器输入172.16.49.2/index.html

wKiom1ad4EWiu6oVAABLwCRb72s400.png

     (2)172.16.49.3的映射代理目录下创建index.php,定义phpinfo()测试语句,在浏览器输入172.16.49.2/index.php

<?php    phpinfo();  ?>

wKioL1ad4IDxTUGGAABxznQECGE079.png

     (3)172.16.49.2下同上放置index.php,在浏览器输入172.16.49.2/index.php

 此时服务器会将.php请求发往php服务器查找,未找到index.php文件

wKiom1ad4EfCXyuLAABC4OyYl-I298.png

     (4)172.16.49.3映射目录下同上放置index.html,在浏览器输入172.16.49.2/index.html

172.16.49.2上找不到静态文件index.html报错

wKiom1ad4EjDhREuAABd11s1K7o785.png

四、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

wKioL1ad4IXj36XuAAE4kf4A_0A535.jpg

 5.phpmariadb服务连接测试

      172.16.49.3php主机上创建index.php测试页,写入如下代码:

<?php

$conn = mysql_connect('172.16.49.4','root','xuding');

if($conn)

echo"OK";

else

echo"Failure";

?>       

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/c24460c9107d4d0e9189b94c4f0fdb15.html