1:查看环境:

 [root@localhost ~]# cat /etc/redhat-release

2:关掉防火墙

 #开机禁用
[root@localhost ~]# chkconfig iptables off
///centos7 systemctl disable firewalld
or #即时生效,重启后失效
[root@localhost ~]# service iptables stop
///centos7 systemctl start firewalld

关闭selinux

#即时生效,重启后失效
[root@localhost ~]#setenforce //将SELINUX=enforcing修改为disabled然后重启生效
[root@localhost ~]# vi /etc/selinux/config

3.配置CentOS 6.7 第三方yum源(CentOS默认的标准源里没有nginx软件包)

 [root@localhost ~]#wget http://www.atomicorp.com/installers/atomic

 [root@localhost ~]#sh ./atomic

 [root@localhost ~]#yum check-update

4:安装开发包和库文件

 #注意不要换行
[root@localhost ~]#yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++- curl curl-devel

5:卸载已安装的apache、mysql、php

# yum remove httpd
# yum remove mysql
# yum remove php

6:安装nginx

# yum install nginx
# service nginx start
///centos7 systemctl status nginx.service
# chkconfig --levels nginx on //设2、3、5级别开机启动
///centos7 systemctl enable nginx.service

7:安装mysql

# yum install mysql mysql-server mysql-devel
# service mysqld start
# chkconfig --levels mysqld on
//登陆MySQL删除空用户,修改root密码
mysql>select user,host,password from mysql.user; mysql>drop user ''@localhost; mysql>update mysql.user set password = PASSWORD('your password') where user='root'; mysql>flush privileges;

8:安装php

//同样注意不要换行
# yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap
//安装php和所需组件使PHP支持MySQL、FastCGI模式
#yum install php-tidy php-common php-devel php-fpm php-mysql
# service php-fpm start
# chkconfig --levels php-fpm on

9:配置nginx支持php

//将配置文件改为备份文件
# mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak //由于原配置文件要自己去写因此可以使用默认的配置文件作为配置文件
# cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf //修改nginx配置文件server段,添加fastcgi支持
# vi /etc/nginx/nginx.conf
//加入index.php
index index.php index.html index.htm; //将下列代码注释去掉,并修改成nginx默认路径
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}

10:配置php

//编辑文件php.ini,在文件末尾添加cgi.fix_pathinfo = 1  

[root@CentOS ~]# vi /etc/php.ini

11:重启nginx php-fpm

# service nginx restart
# service php-fpm restart

12:建立info.php文件

# vi /usr/share/nginx/html/info.php
<?php
phpinfo();
?>

13:测试nginx是否可以解析php

      本地浏览器输入:192.168.32.164/info.php

显示phpinfo界面 环境搭建成功

CentOS6.7搭建LNMP环境的更多相关文章

  1. CentOS6.6搭建LNMP环境

    CentOS6.6搭建LNMP环境 1.设置yum源,本地安装依赖包 1 yum -y install gcc gcc-c++ automake autoconf libtool make 2.下载依 ...

  2. centos6.5搭建lnmp环境

    注:本文原文链接:http://www.cnblogs.com/xiaoit/p/3991037.html 本文只是做保存使用 1:查看环境: [root@10-4-14-168 html]# cat ...

  3. Centos6.x搭建lnmp环境

    查看系统版本 #cat /etc/redhat-release CentOS release 6.7 (Final) 配置静态ip #vi /etc/sysconfig/network-scripts ...

  4. CentOS6.8搭建LNMP环境

    selinux可能会致使编译安装失败,我们先禁用它.永久禁用,需要重启生效 sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/c ...

  5. Docker之使用Docker-compose搭建LNMP环境

    之前有随笔介绍使用Docker-compose搭建LNMP环境(centos6 php5.6) https://www.cnblogs.com/minseo/p/10146982.html 本文介绍D ...

  6. Yum搭建LNMP环境(动、静、库分离)(week4_day5)--技术流ken

    前言 本篇博客使用yum来搭建lnmp环境,将采用动态,静态以及数据库分开安装的方式即nginx,php,mysql.会被分开安装在不同的服务器之上,搭建出来一套lnmp环境,并部署wordpress ...

  7. [Linux] deepin15.8搭建LNMP环境

    LAMP和LNMP LAMP==Linux+Apache+Mysql+PHP LNMP==Linux+Nginx+Mysql+PHP 安装nginx sudo apt install nginx 安装 ...

  8. CentOS 7 源码搭建LNMP环境

    搭建 LNMP 环境 源码包版本 :  CentOS Linux  7 nginx-1.15.1.tar.gz  mysql-boost-5.7.21.tar.gz  php-7.2.7.tar.gz ...

  9. Vmware搭建LNMP环境(Centos7+Nginx+Mysql+PHP7.1.8)

    参考:1.Linux学习之CentOS(一)----在VMware虚拟机中安装CentOS 7(图文教程) 2.Centos7搭建LNMP环境 3.MySQL5.7修改默认root密码 4.CentO ...

随机推荐

  1. C#语法糖大汇总

    首先需要声明的是"语法糖"这个词绝非贬义词,它可以给我带来方便,是一种便捷的写法,编译器会帮我们做转换:而且可以提高开发编码的效率,在性能上也不会带来损失.这让java开发人员羡慕 ...

  2. 敏捷转型历程 - Sprint3 Planning

    我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...

  3. TCP的数据传输小结

    TCP的交互数据流 交互式输入 通常每一个交互按键都会产生一个数据分组,也就是说,每次从客户传到服务器的是一个字节的按键(而不是每次一行) 经受时延的确认 通常TCP在接受到数据时并不立即发送ACK: ...

  4. JS中关于字符串的几个常用又容易忘记的方法

    1>.字符串连接:concat(): 左边字符串. concat(连接的字符串1,字符串2,....); 获取指定位置的字符:charAt(): 返回指定位置的字符:  字符串.charAt(i ...

  5. hasOwnProperty()、propertyIsEnumerable()和isPrototypeOf()的用法

    javascript中有原型这么一个概念,任何一个构造函数都有它对应的原型(prototype),我们可以给这个原型赋予一些我们想要的属性,像下面这样: function Gadget(name, c ...

  6. mono for android 用ISharedPreferences 进行状态保持 会话保持 应用程序首选项保存

    由于项目需要 要保持用户登录状态 要进行状态保持 用途就好像asp.net的session一样 登录的时候进行保存 ISharedPreferences shared = GetSharedPrefe ...

  7. 从零开始,DIY一个jQuery(1)

    从本篇开始会陪大家一起从零开始走一遍 jQuery 的奇妙旅途,在整个系列的实践中,我们会把 jQuery 的主要功能模块都了解和实现一遍. 这会是一段很长的历程,但也会很有意思 —— 作为前端领域的 ...

  8. Lesson 17 Always young

    Text My aunt Jennifer is an actress. She must be at least thirty-five years old. In spit of this, sh ...

  9. 菜鸟在C语言编译,链接时可能遇到的两个问题

    最近在看 CSAPP (Computer Systems A Programmers Perspective 2nd) 的第七章 链接.学到了点东西,跟大家分享.下文中的例子都是出自CSAPP第七章. ...

  10. [MFC] MFC 查找其他窗口句柄 操作其他窗口

    请直接查找CWnd类!!! CWnd* cWnd; cWnd= cWnd->FindWindowW(L"kwmusicmaindlg",NULL); CRect cRect; ...