-------Nginx----------PHP+NFS------------MySql------
192.168.56.202 192.168.56.201 192.168.56.200
安装MySql
安装Nginx
[root@localhost nginx-1.6.0]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module
[root@localhost nginx-1.6.0]# make && make install
[root@localhost nginx-1.6.0]# ln -s /usr/local/nginx/sbin/* /usr/local/sbin/
[root@localhost nginx-1.6.0]# nginx -t
[root@localhost nginx-1.6.0]# nginx
测试:http://192.168.56.202

安装PHP
[root@localhost php-5.3.28]# yum install gd libxml2-devel libjpeg-devel libpng-devel -y
[root@localhost php-5.3.28]# ./configure --prefix=/usr/local/php
--with-gd
--with-zlib
--with-mysql=mysqlnd
--with-pdo-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-config-file-path=/usr/local/php
--enable-mbstring
--enable-fpm
--with-jpeg-dir=/usr/lib
[root@localhost php-5.3.28]# cp php.ini-development /usr/local/php/php.ini
[root@localhost php-5.3.28]# vim /usr/local/php/php.ini
default_charset = "utf-8"
short_open_tag = On
[root@localhost php-5.3.28]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@localhost php-5.3.28]# chmod +x /etc/init.d/php-fpm
[root@localhost php-5.3.28]#chkconfig --add php-fpm
[root@localhost php-5.3.28]#chkconfig php-fpm on
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# vim php-fpm.conf
pid = run/php-fpm.pid
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
[root@localhost ~]# service php-fpm start

整合nginx与PHP
Nginx server 192.156.56.202
[root@localhost ~]# mkdir /www
[root@localhost ~]# chown -R nginx.nginx /www/

[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
location / {
root /www;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /www;
fastcgi_pass 192.168.56.201:9000; //注意为PHP服务器
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}

[root@localhost ~]#/etc/init.d/nginx restart
在PHP服务器上,建立nginx用户,要保证和nginx服务器上的nginx用户id号、组id号一致
[root@localhost ~]# useradd nginx
[root@localhost ~]# vim /usr/local/php/etc/php-fpm.conf
listen = 192.168.56.201:9000     
user = nginx
group = nginx
[root@localhost ~]# /etc/init.d/php-fpm restart

在PHP服务器上,创建NFS共享
[root@localhost ~]# mkdir /www
[root@localhost ~]# chown -R nginx.nginx /www
[root@localhost ~]# vim /etc/exports
/www 192.168.56.0/24(rw,no_root_squash,sync)
no_root_squash:登入 NFS 主机使用分享目录的使用者,如果是 root 的话,那么对于这个分享的目录来说,他就具有 root 的权限!这个项
目『极不安全』,不建议使用!
root_squash:在登入 NFS 主机使用分享之目录的使用者如果是 root 时,那么这个使用者的权限将被压缩成为匿名使用者,通常他的 UID
与 GID 都会变成 nobody 那个系统账号的身份。
[root@localhost ~]# service nfs start

nginx服务器挂载nfs文件,并测试php,测试成功后删除index.php:
[root@localhost ~]# showmount -e 192.168.56.201 //查看共享
[root@localhost ~]# mount -t nfs 192.168.56.201:/www /www
[root@localhost ~]# vim /www/index.php
[root@localhost ~]# service nginx restart

整合PHP与MYSQL
在mysql服务器上创建php服务器能够访问的数据库和用户:
mysql> grant all on *.* to 'root'@'192.168.56.201' identified by 'redhat'
//注意授权的是PHP服务器的登录地址
mysql> flush privileges;
[root@localhost ~]# unzip Discuz_7.2_FULL_SC_UTF8.zip
[root@localhost ~]# mv upload/* /www/
[root@localhost ~]# chmod -R 777 /www/*

浏览器登录:http://http://192.168.56.202/install //注意mysql地址为:192.168.56.200
在mysql服务器上测试:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| discuz |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)

分离式部署LNMP的更多相关文章

  1. Linux系统——LNMP分离式部署

    #### 安装nginx ```[root@localhost ~]# tar xf nginx-1.10.2.tar.gz -C /usr/src/[root@localhost ~]# cd /u ...

  2. LNMP分离式部署

    #### LNMP组合工作流程 在LNMP组合工作时,首先是用户通过浏览器输入域名请求Nginx Web服务,如果请求是静态资源,则由Nginx解析返回给用户:如果是动态请求(.php结尾),那么Ng ...

  3. LNMP分离式部署实例[转]

    很多人在练习部署LNMP环境的时候,大都数是部署在同一个虚拟机上面的.但是实际工作中,我们一般都是分离部署的. 今天我就用3台虚拟机,部署下LNMP环境.以供参考! 网络拓扑图: 首先准备3台虚拟机: ...

  4. 在ConoHa上Centos7环境下源码安装部署LNMP

    本文记录了从源码,在Centos 7上手动部署LNMP环境的过程,为了方便以后对nginx和mariadb进行升级,这里采用yum的方式进行安装. 1.建立运行网站和数据库的用户和组 groupadd ...

  5. 【转载】Centos系统快速部署LNMP环境

    PHP语言在Linux系统上运行的时候,需要在Linux系统上部署相应的Nginx.MySQL.PHP等环境,只有将这些环境参数都设置好,PHP相关应用程序才可正常运行,部署环境的方法有很多种,可手动 ...

  6. Docker Compose 一键部署LNMP

    Docker Compose 一键部署LNMP 目录结构 [root@localhost ~]# tree compose_lnmp/ compose_lnmp/ ├── docker-compose ...

  7. Docker Compose部署lnmp

    参考:https://github.com/micooz/docker-lnmp 一.简介 使用Dcoekr镜像部署lnmp(Linux.Nginx.MySQL.PHP7). 1.1 结构 app └ ...

  8. Docker swarm 使用服务编排部署lnmp

    一.简介 目的:在Docker Swarm集群中,使用stack服务编排搭建lnmp来部署WordPress 使用私有仓库的nginx和php镜像 mysql使用dockerhup最新镜像 使用nfs ...

  9. 使用Docker 一键部署 LNMP+Redis 环境

    使用Docker 部署 LNMP+Redis 环境 Docker 简介 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linu ...

随机推荐

  1. MySQL中有关NULL的计算

    mysql> select NULL=NULL; #判断两个NULL是否相等,结果不是1也不是0 +-----------+ | NULL=NULL | +-----------+ | NULL ...

  2. 敏捷与CMM的恩怨

    模式不同,一种是灵活,一种是严肃.

  3. vue组件封装选项卡

    <template> <myMenu :arr='arr' :arrcontent='content'></myMenu> </template> &l ...

  4. CentOS 6.4 源码安装MySQL 5.6

    1.安装前准备工作 1.1 必备的包 gcc/g++ :MySQL 5.6开始,需要使用g++进行编译.cmake :MySQL 5.5开始,使用cmake进行工程管理,cmake需要2.8以上版本. ...

  5. day 7-14 数据库完整性约束

    一. 介绍 约束条件与数据类型的宽度一样,都是可选参数 作用:用于保证数据的完整性和一致性 主要分为: PRIMARY KEY 标示该字段为表的主键,可以唯一的标示记录 FOREIGN KEY 标示该 ...

  6. C# Note21: 扩展方法(Extension Method)及其应用

    前言 今天在开会时提到的一个概念,入职3个多月多注重在项目中使用C#的编程知识,一直没有很认真地过一遍C#的全部语法,当我们新人被问及是否了解Extension Method时,一时之间竟不能很通俗准 ...

  7. git基本操作1

    1.创建版本库 在文件夹下,打开Git Bash Here ,然后执行git init,文件夹中会多出.git文件夹.(.git可能是隐藏的) 2.创建a.txt vim  a.txt ,并添加到版本 ...

  8. linux audit (9)--生成audit报表

    aureport这个命令可以生成一个总结性的柱状图报表,默认情况下,在/var/log/audit目录下的所有日志文件都会生成一个报表,也可以使用如下命令来指定一个不同的文件,aureport opt ...

  9. qtp 自动化测试--点滴 自定义显示工具菜单 trzedit

    tools-customize-toolbars-勾选后关闭 2 trzedit 使用winobject 方法取值 Window("驷惠WIN系列[汽车4S连锁管理软件] 6.") ...

  10. mybatis-spring-1.2.2.jar下载地址

    http://www.java2s.com/Code/Jar/m/Downloadmybatisspring120jar.htm