Centos安装lnmp环境
1:查看环境:
[root@10-4-14-168 html]# cat /etc/redhat-releaseCentOS release 6.5 (Final)2:关掉防火墙
[root@10-4-14-168 html]# chkconfig iptables off3:配置CentOS 6.0 第三方yum源(CentOS默认的标准源里没有nginx软件包)
#yum check-update4:安装开发包和库文件
|
1
2
3
4
|
#yum -y install ntp make openssl openssl-devel pcre pcre-devel libpnglibpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-develgcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2libxml2-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-ldapphp-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
17
18
19
|
# 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.confindex index.php index.html index.htm;//加入index.phplocation ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; include fastcgi_params; }//将以上代码注释去掉,并修改成nginx默认路径 |
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界面 环境搭建成功 |
Centos安装lnmp环境的更多相关文章
- CentOS安装LNMP环境的基础组件
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. 在安装LNMP环境之前,请确保已经使用yum安装了以下各类基础组件(如果系统已自带,还可以考虑yum update下基础组件): ...
- CentOS编译安装LNMP环境
这里是教大家如何在centos下利用源码编译安装LNMP环境. 工具/原料 centos服务器一台 自用电脑一台 准备篇 配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 配置防火墙,开 ...
- Centos 6.8编译安装LNMP环境
Centos 6.8编译安装LNMP环境 参考资料: http://www.jb51.net/article/107429.htm https://phperzh.com/articles/1360 ...
- CentOS 7 安装 LNMP 环境(PHP7 + MySQL5.7 + Nginx1.10)
记录下在CentOS 7 安装 LNMP 环境(PHP7 + MySQL5.7 + Nginx1.10)过程笔记. 工具 VMware版本号 : 12.0.0 CentOS版本 : 7.0 一.修改 ...
- Shell脚本一键安装LNMP环境
https://sourceforge.net/projects/opensourcefile/files/ Nginx是一款高性能的HTTP和反向代理服务器.Nginx在反向代理,Rewrite规则 ...
- 阿里云Ubuntu安装LNMP环境之PHP7
在QQ群很多朋友问阿里云服务器怎么安装LNMP环境,怎么把项目放到服务器上面去,在这里,我就从头开始教大家怎么在阿里云服务器安装LNMP环境. 在这之前,我们先要知道什么是LNMP. L: 表示的是L ...
- 阿里云Ubuntu安装LNMP环境之Mysql
在QQ群很多朋友问阿里云服务器怎么安装LNMP环境,怎么把项目放到服务器上面去,在这里,我就从头开始教大家怎么在阿里云服务器安装LNMP环境. 在这之前,我们先要知道什么是LNMP. L: 表示的是L ...
- 阿里云Ubuntu安装LNMP环境之Nginx
在QQ群很多朋友问阿里云服务器怎么安装LNMP环境,怎么把项目放到服务器上面去,在这里,我就从头开始教大家怎么在阿里云服务器安装LNMP环境. 在这之前,我们先要知道什么是LNMP. L: 表示的是L ...
- Linux一键安装LNMP环境
Linux一键安装LNMP环境 官方地址:https://lnmp.org/. 参考安装步骤:https://lnmp.org/install.html. 一键安装可以选择mysql版本.php版本, ...
随机推荐
- Shell编程菜鸟基础入门笔记
Shell编程基础入门 1.shell格式:例 shell脚本开发习惯 1.指定解释器 #!/bin/bash 2.脚本开头加版权等信息如:#DATE:时间,#author(作者)#mail: ...
- DBMS_OUTPUT in SQL Developer
I fell sad for all the programmers(including) that has to SQL Developer as sql IDE. However, if you ...
- IntelliIDEA注册码
[http://idea.lanyus.com/] BIG3CLIK6F-eyJsaWNlbnNlSWQiOiJCSUczQ0xJSzZGIiwibGljZW5zZWVOYW1lIjoibGFuIHl ...
- Markdown 软件
<<github.css>> Markdown 软件 :Typora / Haroopad / Markdownpad2 Markdownpad2软件注册及下载地址 邮箱地址: ...
- Hibernate5.2之反向工程
Hibernate5.2之反向工程 一.描述 可能很多人在使用Hibernate进行项目开发 ...
- 【学】AngularJS日记(3)- $apply(), run()方法
$scope.$apply()方法可以强制$apply()里运行的函数所改变的model里的数据直接反应到view里,因为在angular的环境中,有时会用到原生js或者jquery的时候,这些行为有 ...
- [译]How to Setup Sync Gateway on Ubuntu如何在ubuntu上安装sync-gateway
参考文章https://hidekiitakura.com/2015/03/21/how-to-setup-sync-gateway-on-ubuntudigitalocean/ 在此对作者表示感谢 ...
- 流水灯 外侧<->中间<->外侧
/* //side<-center->side //side->center<-side //loop *// #include "reg52.h" voi ...
- Android sdk tool android 命令参数
命令参数说明: $ ./android --? Error: Flag '--?' is not a valid global flag. Did you mean to specify it a ...
- Sorry, but the Android VPN API doesn’t currently allow TAP-based tunnels.
Sorry, but the Android VPN API doesn’t currently allow TAP-based tunnels. Edit .ovpn configfile “dev ...