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寻找符合版本要求的 ...
随机推荐
- bzoj 4827: [Hnoi2017]礼物【FFT】
记得FFT要开大数组!!开到快MLE的那种!!我这个就是例子TAT,5e5都RE了 在这题上花的时间太多了,还是FFT不太熟练. 首先看70分的n方做法:从0下标开始存,先n--,把a数组倍增,然后枚 ...
- phpstorm最新破解办法(2016-10-30)
还是选择license server.然后复制http://jetbrains.tencent.click/ 这个地址进去就可以啦.不行的时候欢迎留言告知,更新破解方法
- Fastjson详解
Fastjson是一个Java语言编写的高性能功能完善的JSON库.它采用一种"假定有序快速匹配"的算法,把JSON Parse的性能提升到极致,是目前Java语言中最快的JSON ...
- python爬虫BeautifulSoup库class_
因为class是python的关键字,所以在写过滤的时候,应该是这样写: r = requests.get(web_url, headers=headers) # 向目标url地址发送get请求,返回 ...
- 【css】如何实现环形进度条
最近团队的童鞋接到了一个有关环形进度条的需求,想要还原一个native的沿环轨迹渐变进度条的效果,看到这个效果的时候,笔者陷入了沉思.. 环形进度条的效果,最先想到的就是使用CSS利用两个半圆的hac ...
- django templates模板
Django templates模板 HTML代码可以被直接硬编码在views视图代码中,虽然这样很容易看出视图是怎么工作的,但直接将HTML硬编码到视图里却并不是一个好主意. 让我们来看一下为什么: ...
- _bzoj1010 [HNOI2008]玩具装箱toy【斜率优化dp】
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1010 裸的斜率优化,第一次写队首维护的时候犯了个智障错误,队首维护就是维护队首,我怎么会那队 ...
- 拓扑排序/DFS HDOJ 4324 Triangle LOVE
题目传送门 题意:判三角恋(三元环).如果A喜欢B,那么B一定不喜欢A,任意两人一定有关系连接 分析:正解应该是拓扑排序判环,如果有环,一定是三元环,证明. DFS:从任意一点开始搜索,搜索过的点标记 ...
- Android偏好设置(7)自定义Preference,和PreferenceDialog
Building a Custom Preference The Android framework includes a variety of Preference subclasses that ...
- 可变类型的安全性——更锋利的C#代码小记(2)
ReadOnlyCollection类型是.NET系统类库提供的一个只读集合类型,它与原来的List<string>不存在任何类型转换关系,因此可以从根本上阻止外部对其的修改操作using ...