CentOS6.7搭建LNMP环境
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环境的更多相关文章
- CentOS6.6搭建LNMP环境
CentOS6.6搭建LNMP环境 1.设置yum源,本地安装依赖包 1 yum -y install gcc gcc-c++ automake autoconf libtool make 2.下载依 ...
- centos6.5搭建lnmp环境
注:本文原文链接:http://www.cnblogs.com/xiaoit/p/3991037.html 本文只是做保存使用 1:查看环境: [root@10-4-14-168 html]# cat ...
- Centos6.x搭建lnmp环境
查看系统版本 #cat /etc/redhat-release CentOS release 6.7 (Final) 配置静态ip #vi /etc/sysconfig/network-scripts ...
- CentOS6.8搭建LNMP环境
selinux可能会致使编译安装失败,我们先禁用它.永久禁用,需要重启生效 sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/c ...
- Docker之使用Docker-compose搭建LNMP环境
之前有随笔介绍使用Docker-compose搭建LNMP环境(centos6 php5.6) https://www.cnblogs.com/minseo/p/10146982.html 本文介绍D ...
- Yum搭建LNMP环境(动、静、库分离)(week4_day5)--技术流ken
前言 本篇博客使用yum来搭建lnmp环境,将采用动态,静态以及数据库分开安装的方式即nginx,php,mysql.会被分开安装在不同的服务器之上,搭建出来一套lnmp环境,并部署wordpress ...
- [Linux] deepin15.8搭建LNMP环境
LAMP和LNMP LAMP==Linux+Apache+Mysql+PHP LNMP==Linux+Nginx+Mysql+PHP 安装nginx sudo apt install nginx 安装 ...
- 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 ...
- Vmware搭建LNMP环境(Centos7+Nginx+Mysql+PHP7.1.8)
参考:1.Linux学习之CentOS(一)----在VMware虚拟机中安装CentOS 7(图文教程) 2.Centos7搭建LNMP环境 3.MySQL5.7修改默认root密码 4.CentO ...
随机推荐
- ActionContext.getContext().getSession()
ActionContext.getContext().getSession() 获取的是session,然后用put存入相应的值,只要在session有效状态下,这个值一直可用 ActionConte ...
- Linux:将rhel yum 切换到centos yum
Red Hat Enterprise Linux Server(RHEL) yum安装软件时This system is not registered with RHN. RHN support wi ...
- Linux 入门之网络配置
查看网络状态 ifconfig 修改网络参数 实验环境centos6.5,其他系统自行百度 ls /etc/sysconfig/network-scripts 显示所有文件, vi /etc/sysc ...
- Linux环境变量设置
修改环境变量PATH 最近为root添加一个环境变量发现sudo su进去没有变化所以总结了一下所有设置环境变量的方法: 查看PATH:echo $PATH 直接在命令行修改,就可以使用,但是只有在当 ...
- 【python之路3】if 语句
1.if语句用法(if....else....) #!/usr/bin/env python # -*- coding:utf-8 -*- my_name = raw_input("plea ...
- .NET Core dotnet 命令大全
dotnet 命令大全,让你理解dotnet 命令. 本文将以一个实例串起 dotnet 所有命令,让你玩转dotnet 命令. 本篇文章编写环境为windows 10 ,dotnet 命令同样适用于 ...
- 背后的故事之 - 快乐的Lambda表达式(二)
快乐的Lambda表达式 上一篇 背后的故事之 - 快乐的Lambda表达式(一)我们由浅入深的分析了一下Lambda表达式.知道了它和委托以及普通方法的区别,并且通过测试对比他们之间的性能,然后我们 ...
- [译]ZOOKEEPER RECIPES-TWO PHASED COMMIT
两段式提交 两段式提交协议可以让所有分布式系统中的客户端达成协议同时提交或回滚事务. 在ZooKeeper中你可以通过协调者(coordinator)创建一个事务节点来实现两段式提交.例如" ...
- java中判断list是否为空的用法
1.如果想判断list是否为空,可以这么判断: if(null == list || list.size() ==0 ){ //为空的情况 }else{ //不为空的情况 } 2.list.isEmp ...
- C/S架构和B/S架构的概念和区别
C/S 架构 C/S 架构是一种典型的两层架构,其全程是Client/Server,即客户端服务器端架构,其客户端包含一个或多个在用户的电脑上运行的程序,而服务器端有两种,一种是数据库服务器端,客户端 ...
