1:查看环境:

1
2
[root@10-4-14-168 html]# cat /etc/redhat-release
CentOS release 6.5 (Final)

2:关掉防火墙

1 [root@10-4-14-168 html]# chkconfig iptables off

3:配置CentOS 6.0 第三方yum源(EPEL)

4:安装开发包和库文件 

1
2
3
4
#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++-33 curl curl-devel

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

1
2
3
# yum remove httpd
# yum remove mysql
# yum remove php

6:安装nginx

1
2
3
4
# yum install nginx
# service nginx start
# chkconfig --levels 235 nginx on
//设2、3、5级别开机启动

7:安装mysql

1
2
3
# yum install mysql mysql-server mysql-devel
# service mysqld start
# chkconfig --levels 235 mysqld on

1
2
3
4
5
6
7
8
登陆MySQL删除空用户,修改root密码
mysql>select user,host,password from mysql.user;

mysql>drop user ''@localhost;

mysql>update mysql.user set password = PASSWORD('*********') where user='root';

mysql>flush privileges;

8:安装php

1
2
# 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模式

1 #yum install  php-tidy php-common php-devel php-fpm php-mysql

1
2
# service php-fpm start
# chkconfig --levels 235 php-fpm on

9:配置nginx支持php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak
//将配置文件改为备份文件
# cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf
//由于原配置文件要自己去写因此可以使用默认的配置文件作为配置文件
//修改nginx配置文件,添加fastcgi支持
# vi /etc/nginx/nginx.conf
index index.php index.html index.htm;
//加入index.php,将以下代码注释去掉,并修改成nginx默认路径
location ~ \.php$ {
            fastcgi_pass    127.0.0.1:9000;
            fastcgi_index   index.php;
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include         fastcgi_params;
        }

10:配置php

1
2
//编辑文件php.ini,在文件末尾添加cgi.fix_pathinfo = 1
[root@Centos ~]# vi /etc/php.ini

11:重启nginx php-fpm

1
2
# service nginx restart
# service php-fpm restart

12:建立info.php文件

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

13:测试nginx是否解析php

1
2
本地浏览器输入:192.168.1.105/info.php
显示php界面  环境搭建成功

这种软件包安装方式虽然简单,但版本较低,而且软件分布在/usr/下各个目录中,有些混乱,建议官方下载最新的稳定版源码,configure --prefix=/opt/software_name 来编译安装到一个目录下,便于管理。

centos 6.5搭建LNMP环境的更多相关文章

  1. CentOS 7 上搭建LNMP环境

    (转自美团云知识库Chris) 简介 LNMP是Linux.Nginx.MySQL(MariaDB)和PHP的缩写,这个组合是最常见的WEB服务器的运行环境之一.本文将带领大家在CentOS 7操作系 ...

  2. 烂泥:学习centos之快速搭建LNMP环境

    本文由秀依林枫提供友情赞助,首发于烂泥行天下 以前在centos下安装软件都是喜欢源码安装,不过昨天因为一个事情需要一个centos 下的LNMP环境.反倒不会搞了,今天特意记录下,以备后续使用. 一 ...

  3. CentOS 6.6搭建LNMP环境

    一.安装前 1.关闭linux的安全机制 vim /etc/selinux/config SELINUX=enforcing  改为  SELINUX=disabled 2.关闭iptables防火墙 ...

  4. Centos 7.6搭建LNMP环境的web服务器

    一.安装软件 1.1.MYSQL安装 下载mysql的repo源: wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rp ...

  5. 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 ...

  6. Centos 7 下yum搭建lnmp环境(yum安装方式)

    我们都知道linux下安装软件主要有三种方式: 1.源码编译安装,即下载软件源代码,利用gcc g++ make 等编译工具进行编译安装: 此方式的优点:可以指定软件版本,可选择性好:编译时可以手动指 ...

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

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

  8. WIN10 vagrant和virtualbox虚拟机和一键搭建lnmp环境配置thinkphp虚拟主机

    版本:win10系统 virtualbox:5.1.26 vagrant :1.9.7 centos 7.0 xshell/git 首先下载好对应版本的软件 配置vagrant和virtualbox ...

  9. docker搭建lnmp环境(问题,资料,命令)

    入门参考 http://www.runoob.com/docker/docker-install-nginx.html 十大常用命令玩转docker 1. #从官网拉取镜像 docker pull & ...

随机推荐

  1. Unity5.5.2 CD旋转 顺时针逆时针

    UGUI 下  Sprite_CD  在Inspector下  Image(Script) 下  Clock wise  勾选  决定  CD是顺时针还是逆时针  默认是顺时针  勾选则为逆时针

  2. centos7 .net core 使用supervisor守护进程,可以后台运行

    1.安装supervisor yum install supervisor 2.配置supervisor vi /etc/supervisord.conf 拉到最后,这里的意思是 /etc/super ...

  3. Linux Linux下安装wine

    Linux下安装wine Linux下安装wine可以从源码编译安装,但一般都觉得麻烦,所以尽量利用yum进行安装,解决很多包的依赖关系. 首先安装一个epel rpm -ivh http://dl. ...

  4. vs2015 使用 Eazfuscator.NET 3.3

    出现问题: Unable to cast object System.Xml.XmlComment’ to type ‘System.Xml.XmlElement’ 解决办法: 打开 *.csproj ...

  5. Mybatis-generator逆向工程

    $.Mybatis-generator介绍 MyBatis Generator(MBG)是MyBatis MyBatis 和iBATIS的代码生成器.它将为所有版本的MyBatis以及版本2.2.0之 ...

  6. Jquery的动画

    $下载链接详情点击Jquery-day01查看官方网站下载地址 Jquery-day02 1.Jquery动画使用animate-(JQ-2.1) <!DOCTYPE html> < ...

  7. 声明函数指针、回调函数、函数对象------c++程序设计基础、编程抽象与算法策略

    声明函数指针 #include<iostream> using namespace std; double a(double aa) { return aa; } int main() { ...

  8. scrapy 爬取天猫商品信息

    spider # -*- coding: utf-8 -*- from urllib.parse import urlencode import requests import scrapy impo ...

  9. Android Gradle 隐形依赖的奇怪案例

    相信 Android 开发者都有在 Android Studio 中升级 compileSdkVersion 的经历,这个时候如果你使用了 support 包,并同时升级,那么可能会出现一个错误提示. ...

  10. 「模拟赛20190327」 第二题 DP+决策单调性优化

    题目描述 小火车虽然很穷,但是他还是得送礼物给妹子,所以他前往了二次元寻找不需要钱的礼物. 小火车准备玩玩二次元的游戏,游戏当然是在一个二维网格中展开的,网格大小是\(n\times m\)的,某些格 ...