1.前期准备工作

更新 yum 源,自带的源没有 PHP5.6

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum install update

2.防火墙  

一、配置防火墙,开启80端口、3306端口
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。
1、关闭firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2、安装iptables防火墙
yum install iptables-services #安装
vi /etc/sysconfig/iptables #编辑防火墙配置文件
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
:wq! #保存退出
systemctl restart iptables.service #最后重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
二、关闭SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
:wq! #保存退出
setenforce 0 #使配置立即生效

3.安装Mysql/Mariadb

安装 Mariadb: yum -y install mariadb.x86_64 mariadb-server.x86_64 mariadb-devel.x86_64

使用下面命令设置root密码: mysql_secure_installation

从最新版本的linux系统开始,默认的是 Mariadb而不是mysql!

使用系统自带的repos安装很简单:

yum install mariadb mariadb-server

systemctl start mariadb ==> 启动mariadb

systemctl enable mariadb ==> 开机自启动

mysql_secure_installation ==> 设置 root密码等相关

mysql -uroot -p123456 ==> 测试登录!

4.安装Nginx

yum install nginx18

用systemctl status nginx.service查看

用systemctl restart nginx.service重启

5.安装PHP

yum install php70w-fpm php70w-mysql php70w-mysqli php70w php70w-opcache php70w-gd php70w-intl php70w-mbstring php70w-exif php70w-mcrypt php70w-openssl
之前试过没装够php extension , laravel 死活报错,现在怕了,一次装够他

6.安装composer

使用命令下载:
curl -sS https://getcomposer.org/installer | php -- --install-dir=安装路径
下载之后设置环境变量:
mv composer.phar /usr/local/bin/composer
并修改权限,否则执行的时候会报错
chmod -R 777 /usr/local/bin/composer
然后在终端直接输出composer即可看到安装成功的界面

7.配置

.首先配置下 php.ini 我的系统默认安装后 php.ini 的位置是 /etc/php.ini 主要需要修改的有下面这些:
cgi.fix_pathinfo=0 --这个原先是注释的,取消注释把值改成0就行.首先配置下 php.ini 我的系统默认安装后 php.ini 的位置是 /etc/php.ini 主要需要修改的有下面这些:
cgi.fix_pathinfo=0 --这个原先是注释的,取消注释把值改成0就行

vi /etc/nginx/nginx.conf

把配置文件里面的 server{ ****}这部分替换成下面这段就可以了

server {
listen 80;
server_name example.com;
location / {
root /usr/share/nginx/html/;
try_files $uri $uri/ /index.php?$query_string;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html/;
}
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/html/;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

配置 php-fpm :
vi /etc/php-fpm.d/www.conf
修改user和group
user = nginx`
group = nginx

centOS7+mariadb+Nginx+PHP7.0 安装的更多相关文章

  1. 树莓派安装 Nginx + PHP7.0 + Pi Dashboard

    之前我们介绍过树莓派搭建LNMP环境的方法,以及给树莓派装一个仪表盘来监控树莓派运行状态.近期有用户反馈树莓派最新版的系统已经无法找到 PHP5 的软件包了,这是因为新版本已经用 PHP7 替代了 P ...

  2. inux环境PHP7.0安装

    inux环境PHP7.0安装   PHP7和HHVM比较PHP7的在真实场景的性能确实已经和HHVM相当, 在一些场景甚至超过了HHVM.HHVM的运维复杂, 是多线程模型, 这就代表着如果一个线程导 ...

  3. centos7.x部署php7.0、mysql

    1.安装httpd yum install httpd systemctl start httpd.service #启动命令 systemctl stop httpd.service #停止命令 s ...

  4. CentOS7下搭建Nginx+PHP7的安装配置

    一.安装编译工具及库文件: yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel 环境要求 nginx是C ...

  5. Ubuntu安装Nginx+PHP7.0.4+MySQL5.6

    安装Nginx 1.首先添加nginx_signing.key(必须,否则出错) $ wget http://nginx.org/keys/nginx_signing.key $ sudo apt-k ...

  6. Linux环境PHP7.0安装

    原文地址:http://blog.csdn.net/21aspnet/article/details/47708763 PHP7和HHVM比较 PHP7的在真实场景的性能确实已经和HHVM相当, 在一 ...

  7. CentOs环境下给PHP7.0安装fileinfo扩展

    由于项目搭建处于一个初步阶段,由于环境的不成熟出现过一系列的问题是难免的,在关于文件操作的程序中,报出一个缺少扩展的错误,已经解决~ 看一下官方给出的说明,http://php.net/manual/ ...

  8. phpstudy 2016 切换Nginx+php7.0版本所需运行库 vc14 + 安装redis拓展

    去微软官方下载vc14的运行库 链接:https://www.microsoft.com/en-us/download/details.aspx?id=48145 32位运行库 安装成功 切换版本成功 ...

  9. Centos环境下给PHP7.0安装yaf扩展

    首先要知道PHP的安装目录在哪里,以我当前的路径为例,在/usr/local/php目录下. 下一步需要下载扩展包,进入http://pecl.php.net/package/yaf寻找符合版本要求的 ...

随机推荐

  1. (博弈论 高精度小数)51NOD 1185 威佐夫游戏 V2

    有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中取相同数量的石子,但不可不取.拿到最后1颗石子的人获胜.假设A B都非常聪明,拿石子的过程中不会出现失误.给出2堆石子的数量, ...

  2. pycharm快捷键及一些常用设置(转载)

    转载于:http://blog.csdn.net/wangtong95/article/details/51100872 在PyCharm /opt/pycharm-3.4.1/help目录下可以找到 ...

  3. Hello!六月

    把这里当做记事本应该没人介意吧: 太忙了!六月! ACM: 背包九讲

  4. 51nod 1133 不重叠的线段(贪心)

    1133 不重叠的线段  基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题  收藏  关注 X轴上有N条线段,每条线段有1个起点S和终点E.最多能够选出多少条互不重叠 ...

  5. 修改SolrCloud在ZooKeeper中的配置文件操作记录

    修改SolrCloud在ZooKeeper中的配置文件操作记录. 命令执行目录: /opt/solr-/server/scripts/cloud-scripts/ 1.下载配置文件 ./zkcli., ...

  6. Java中的流(2)字节流-InputStream和OutputStream

    字节流的两个顶层类是抽象类:InputStream和OutputStream 1. OutputStream void write(int b) 往流中写一个字节b void write(byte b ...

  7. Android 实现对多个EditText的监听

    create_account=(EditText)findViewById(R.id.create_account); create_password=(EditText)findViewById(R ...

  8. Android应用开发细节点

    1.如果handler是在主线程声明,就属于主线程,handleMessage属于引用handler的那个线程:2.ByteArrayOutputStream/ByteArrayInputStream ...

  9. iOS programming UITabBarController

    iOS programming UITabBarController 1.1 View controllers become more interesting when the user's acti ...

  10. RGB、YUV和YCbCr介绍【转】

    RGB: 就是常说的红(Red).绿(Green)和蓝(Blue),每个图像的像素点由RGB三个通道的值组成. YUV和YCbCr: YUV与RGB的转换: Y'= 0.299*R' + 0.587* ...