三台主机搭建LAMP(apache、mariadb、php)
实验环境:均是CentOS7
httpd:172.16.254.88 2.4.6
PHP:172.16.250.140 5.4.16
mariadb:172.16.250.94 5.5.52
第三方应用程序是:phpMyAdmin
1、先配置httpd主机:
[root@www localhost]#cd /etc/httpd/conf.d/
[root@conf.d localhost]#cat vhost.conf
DirectoryIndex index.php
<VirtualHost 172.16.254.88:80>
ServerName 172.16.254.88
DocumentRoot "/data/www"
ProxyRequests Off #关闭正向代理
ProxyPassMatch ^/(.*\.php)$ fcgi://172.16.250.140:9000/data/www/$1 #表示后缀名为php的动态资源请求的时候转发到ip为172.16.250.140的主机进行处理;
ProxyPassMatch ^/(pmstatus|ping.*)$ fcgi://172.16.250.140:9000/$1 #测试pmstatus和ping的内置功能
<Directory "/data/www">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
ErrorLog /var/log/httpd/test_error.log
CustomLog /var/log/httpd/test_access.log combined
</VirtualHost>
[root@conf.d localhost]#cd /data/www #网页文件和第三方程序的路径,与PHP服务器上的文件一模一样
[root@www localhost]#ls
index1.php index.php phpMyAdmin-4.0.10.20 pma
[root@www localhost]#ll
total 12
-rw-r--r--. 1 root root 13 Jun 3 20:48 index1.php
-rw-r--r--. 1 root root 261 Jun 3 23:35 index.php
drwxr-xr-x. 9 root root 4096 Jun 3 23:18 phpMyAdmin-4.0.10.20
lrwxrwxrwx. 1 root root 21 Jun 4 00:10 pma -> phpMyAdmin-4.0.10.20/ #程序文件的软连接,方便访问
[root@phpMyAdmin-4.0.10.20 localhost]#pwd
/data/www/phpMyAdmin-4.0.10.20
[root@phpMyAdmin-4.0.10.20 localhost]#cp -av config.sample.inc.php config.inc.php
$cfg['blowfish_secret'] = 'jngkasfnysagfehfcsdkjdfa8b6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
##添加一些字符串
$cfg['Servers'][$i]['host'] = '172.16.250.94'; #配成mariadb的地址
[root@www localhost]#pwd
/data/www
[root@www localhost]#cat index.php
<html>
<title>test</title>
<body>
<h2> CentOS7 Text</h2>
<?php
phpinfo();
?>
</body>
</html>
[root@libraries localhost]#pwd
/data/www/phpMyAdmin-4.0.10.20/libraries
* MySQL hostname or IP address
*
* @global string $cfg['Servers'][$i]['host']
*/
$cfg['Servers'][$i]['host'] = '172.16.250.94'; ##修改mariadb的地址
2、PHP主机:
[root@www localhost]#yum install -y php php-fpm php-mysql
[root@www localhost]#cd /etc/php-fpm.d/
[root@php-fpm.d localhost]#cat www.conf
; Start a new pool named 'www'.
[www] ; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 172.16.250.140:9000 #本服务器地址 ; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: -1
;listen.backlog = -1
pm.status_path = /pmstatus #测试本服务器的进程状态
ping.path = /ping #ping的测试
ping.response = pong #pong的回应,测试服务器的通讯状态
curity feature and should be used whenever
; possible. However, all PHP paths will be relative to the chroot
; (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot = ; Chdir to this directory at the start. This value must be an absolute path.
; Default Value: current directory or / when chroot
chdir = /data/www #第三方程序存放目录和httpd的/data/www中的文件一模一样 ; Set session path to a directory owned by process user
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
3、mariadb主机:
[root@~ localhost]#yum -y install mariadb-server
[root@my.cnf.d localhost]#pwd
/etc/my.cnf.d
[root@my.cnf.d localhost]#cat server.cnf
#
# this is only for the mysqld standalone daemon
[mysqld]
skip_name_resolve=ON
innodb_file_per_table=ON
#给用户授权连接,同样的给httpd的用户也要授权
[root@my.cnf.d localhost]#mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.52-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.16.250.94' IDENTIFIED BY '123456';
最后测试展示:输入
http://172.16.254.88/pma/index.php

输入:http://172.16.254.88/pmstatus

输入:http://172.16.254.88/

输入:http://172.16.254.88/ping

三台主机搭建LAMP(apache、mariadb、php)的更多相关文章
- Linux(Centos7)搭建LAMP(Apache+PHP+Mysql环境)
目录 Linux搭建LAMP(Apache+PHP+Mysql环境)Centos7 一. 检查系统环境 1.确认centos版本 2.检查是否安装过apache 3.检查是否安装过Mysql 4.清理 ...
- centos7.2(二)搭建lamp(Apache+PHP+Mysql环境)教程
开始安装前,看说明. 说明0 查看服务器是否能被ssh登陆 http://tool.chinaz.com/port/ 如果显示关闭,说明被大陆封闭了,删除服务器重新建立一个. 说明1:Centos7 ...
- Linux搭建lamp(Apache+PHP+Mysql环境)centos7.2版详细教程
我们更多的网站服务器是选择了Linux系统,这里建议你选择centos,这也是阿里云ecs推荐的系统,在服务器上比较推荐centos,特别对于新手,首选CentOS,并不是centos比Debian和 ...
- HHvm建站环境搭建方法:Nginx,Mariadb,hhvm及lnmp/lamp安装部署
HHVM起源于Facebook公司,是一个开源的PHP虚拟机,使用JIT的编译方式以及其他技术,让PHP代码的执行性能大幅提升.HHVM提升PHP性能的途径,采用的方式就是替代Zend引擎来生成和执行 ...
- •搭建LAMP环境及快速部署双网站并实现基于域名的虚拟主机
本节所讲内容: 实战:搭建LAMP环境及快速部署双网站并实现基于域名的虚拟主机 LAMP架构:??? Linux+Apache+Mysql+PHP Linux+Apache+Mysql/MariaDB ...
- [PHP] ubuntu16.04配置Lamp环境(搭建linux+apache+mysql+php7环境)
reference : http://blog.csdn.net/Abyss_sliver/article/details/77621404 好久没有在Linux环境下进行开发了,比较常用的还是win ...
- Ubuntu 17.10 用 apt 搭建 lamp 环境、安装 phpmyadmin、redis 服务+扩展、mysql 扩展、开启错误提示、配置虚拟主机
2018-02-24 13:50:30 更新: 个人喜欢相对原生又不太麻烦,所以用 apt 构建环境.不过,最近使用到现在记得出现过了 3 次 apache 或 mysql 服务器无法启动或无法连接的 ...
- Ubuntu16.04环境下搭建基于三台主机的mysql galera cluster集群(实测有效)
(注意: (1)文中红色字体部分不一定需要操作 (2)由于word文档编辑的原因,实际操作时部分命令需要手动输入!!直接复制粘贴会提示错误!! ) 一 搭建环境: 1 Ubuntu16.04版本(系 ...
- Install LAMP Server (Apache, MariaDB, PHP) On CentOS/RHEL/Scientific Linux 7
Install LAMP Server (Apache, MariaDB, PHP) On CentOS/RHEL/Scientific Linux 7 By SK - August 12, 201 ...
随机推荐
- NERO8.0刻录系统光盘
正常启动NREO,点击NERO 8.0左下角图标(启动NERO应用程序和工具),选NERO Express Essentials,在左边的几个选项中选择“映像.项目.复制”,右边选“光盘映像或保存的项 ...
- Yii2 跨库orm实现
近期在对公司的Yii2项目进行子系统拆分,过度阶段难免会有一些跨库操作,原生语句还好,加下库名前缀就可以了,可是到了orm问题就来了,特别是用到model做查询的时候,现在来记录一下跳过的坑, 像下面 ...
- 【BZOJ4843】[Neerc2016]Expect to Wait 排序
[BZOJ4843][Neerc2016]Expect to Wait Description ls最近开了一家图书馆,大家听说是ls开的,纷纷过来借书,自然就会出现供不应求的情况, 并且借书的过程类 ...
- Mybatis的配置文件和映射文件详解
一.Mybatis的全局配置文件 1.SqlMapConfig.xml是mybatis的全局配置文件,配置内容如下: properties(属性) settings(全局配置参数) typeAlias ...
- 使用jdk中keytool生成证书
-genkey 在用户主目录中创建一个默认文件".keystore",还会产生一个mykey的别名,mykey中包含用户的公钥.私钥和证书 -alias 产生别名 -keystor ...
- ridge regression 无惩罚,导致预测结果空间过大而无实用价值
[ biased regression methods to reduce variance---通过偏回归来减小方差] https://onlinecourses.science.psu.edu/s ...
- freetype下载和配置
一 下载编译freetype库 1 下载 地址:http://www.freetype.org/ 得到压缩文件:freetype-2.5.3.tar.gz 2 解压: 直接解压,得到文件夹freety ...
- LeetCode:分发饼干【455】
LeetCode:分发饼干[455] 题目描述 假设你是一位很棒的家长,想要给你的孩子们一些小饼干.但是,每个孩子最多只能给一块饼干.对每个孩子 i ,都有一个胃口值 gi ,这是能让孩子们满足胃口的 ...
- em、pt、px和百分比
浏览器默认的字体大小为100%=16px=12pt=1em px像素(Pixel):是固定大小的单元.相对长度单位.像素px是相对于显示器屏幕分辨率而言的.一个像素等于电脑屏幕上的一个点(是你屏幕分辨 ...
- Object.create用法
用法: Object.create(object, [,propertiesObject]) 创建一个新对象,继承object的属性,可添加propertiesObject添加属性,并对属性作出详细解 ...