centOS7+mariadb+Nginx+PHP7.0 安装
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 安装的更多相关文章
- 树莓派安装 Nginx + PHP7.0 + Pi Dashboard
之前我们介绍过树莓派搭建LNMP环境的方法,以及给树莓派装一个仪表盘来监控树莓派运行状态.近期有用户反馈树莓派最新版的系统已经无法找到 PHP5 的软件包了,这是因为新版本已经用 PHP7 替代了 P ...
- inux环境PHP7.0安装
inux环境PHP7.0安装 PHP7和HHVM比较PHP7的在真实场景的性能确实已经和HHVM相当, 在一些场景甚至超过了HHVM.HHVM的运维复杂, 是多线程模型, 这就代表着如果一个线程导 ...
- centos7.x部署php7.0、mysql
1.安装httpd yum install httpd systemctl start httpd.service #启动命令 systemctl stop httpd.service #停止命令 s ...
- CentOS7下搭建Nginx+PHP7的安装配置
一.安装编译工具及库文件: yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel 环境要求 nginx是C ...
- Ubuntu安装Nginx+PHP7.0.4+MySQL5.6
安装Nginx 1.首先添加nginx_signing.key(必须,否则出错) $ wget http://nginx.org/keys/nginx_signing.key $ sudo apt-k ...
- Linux环境PHP7.0安装
原文地址:http://blog.csdn.net/21aspnet/article/details/47708763 PHP7和HHVM比较 PHP7的在真实场景的性能确实已经和HHVM相当, 在一 ...
- CentOs环境下给PHP7.0安装fileinfo扩展
由于项目搭建处于一个初步阶段,由于环境的不成熟出现过一系列的问题是难免的,在关于文件操作的程序中,报出一个缺少扩展的错误,已经解决~ 看一下官方给出的说明,http://php.net/manual/ ...
- phpstudy 2016 切换Nginx+php7.0版本所需运行库 vc14 + 安装redis拓展
去微软官方下载vc14的运行库 链接:https://www.microsoft.com/en-us/download/details.aspx?id=48145 32位运行库 安装成功 切换版本成功 ...
- Centos环境下给PHP7.0安装yaf扩展
首先要知道PHP的安装目录在哪里,以我当前的路径为例,在/usr/local/php目录下. 下一步需要下载扩展包,进入http://pecl.php.net/package/yaf寻找符合版本要求的 ...
随机推荐
- L - Prime Number(求n内质数的个数)
Description Write a program which reads an integer n and prints the number of prime numbers which ar ...
- Use Power bi Mobile Show SSRS 2016 Mobile Report;使用 Power BI Mobile 查阅ssrs2016 mobile report
使用 power bi mobile 查阅 ssrs 2016 mobile report 很简单,以下是IOS客户端的演示. 系统自带了演示数据,包含power bi 的和 ssrs mobile ...
- Hibernate3的hbm文件错误引用dtd文件导致项目无法启动问题处理
错误信息: org.hibernate.InvalidMappingException: Could not parse mapping document from resource /***/*** ...
- 关于c头文件的使用的小记录
在用visual studio实现数据结构上的一些结构与算法的时候,想在一个工程中建立几个文件,然后主文件可以使用其他文件的函数与变量(比如定义的结构体还有数据结构接口函数). 我们可以利用头文件来 ...
- CentOS系统里如何正确取消或者延长屏幕保护自动锁屏功能(图文详解)
不多说,直接上干货! 对于我这里想说的是,分别从CentOS6.X 和 CentOS7.X来谈及. 1. 问题:默认启动屏幕保护 问题描述: CentOS系统在用户闲置一段时间(默认为5分钟)后, ...
- 自学 iOS - 三十天三十个 Swift 项目 第二天
继续做仿造着别人的第二个 1.首先下载 一些字体 网上搜索 "造字工房" 2.把下载的相应字体文件放到工程之中,就Ok了 不多说 效果如下 可以下面这个方法 检索项目里面所有的字体 ...
- 如何向妻子解释OOD (转)
此文译自CodeProject上<How I explained OOD to my wife>一文,该文章在Top Articles上排名第3,读了之后觉得非常好,就翻译出来,供不 ...
- MTK处理器手机 解锁Bootloader 教程
目前很多手机都需要解锁Bootloader之后才能进行刷机操作 本篇教程教你如何傻瓜式解锁Bootloader 首先需要在设置-关于手机 找到版本号(个别手机可能是内核版本号,甚至其他) 然后 快 ...
- Node.js——获取文件上传进度
https://juejin.im/post/5a77a46cf265da4e78327552?utm_medium=fe&utm_source=weixinqun
- 按键精灵txt判断
句子 = "度阿斯达娘阿婶是大的百度知道" 词 = "百度知道" MyPos = Instr(句子, 词) If MyPos > 0 Then Tra ...