需求:在Centos7.3下搭建LNMP环境

文章转载自:http://blog.csdn.net/wszll_alex/article/details/76285324  作者:狂热森林
. 关闭防火墙和selinux 打开文件selinux vim /etc/sysconfig/selinux 将文件中SELINUX=enforcing改为disabled,然后执行”setenforce ″不用重启地关闭selinux。 SELINUX=disabled 关闭放火墙 systemctl stop firewalld.service .安装软件
2.1.MYSQL安装 下载MySQL的repo源 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 安装mysql-community-release-el7-.noarch.rpm包 rpm -ivh mysql-community-release-el7-.noarch.rpm 安装MYSQL ​ sudo yum install -y mysql-server ​ 更改MYSQL用户权限: sudo chown -R root:root /var/lib/mysql ​ 重启服务: systemctl restart mysql.service 登录,并修改密码: mysql -u root
mysql > use mysql;
mysql > update user set password=password(‘‘) where user=‘root‘;
mysql > exit; .2nginx安装 下载对应当前系统版本的nginx包 ​ wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm 建立nginx的yum仓库(默认yum是没有nginx的) rpm -ivh nginx-release-centos--.el7.ngx.noarch.rpm 下载并安装nginx ​ yum install -y nginx nginx启动 ​ systemctl start nginx.service .3安装php rpm 安装 Php7 相应的 yum源 rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 安装php7. yum install -y php70w 安装PHP扩展 yum install -y php70w-mysql.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 安装php FPM ​ yum install -y php70w-fpm . 修改配置文件
.1修改Nginx配置文件 nginx配置文件位置:(/etc/nginx/conf.d/default.conf) vim /etc/nginx/conf.d/default.conf ​ 修改 root目录,可自定义: root /forest/nginxDir/html; ​ 配置php解析,修改 下面代码中黑色加粗部分: location ~.php$ {
root /forest/nginxDir/html;
​ fastcgi_pass 127.0.0.1:;
​ fastcgi_index index.php;
​fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
​ include fastcgi_params;
​ } 3.2 修改php-fpm配置文件 php-fpm配置文件位置:(/etc/php-fpm.d/www.conf)
​ 修改 user =nginx
​ group=nginx .放入测试文件 cd /forest/nginxDir/html
echo 'hello eric' >index.php .启动服务
.1启动nginx服务: systemctl start nginx.service ​ 查看启动状态: systemctl status nginx 看到以下字眼说明启动成功!
​Active: active (running) since 六 -- :: CST; 50min ago
5.2.启动PHP-FPM: systemctl start php-fpm.service ​ 查看启动状态: systemctl status php-fpm.service 看到以下字眼说明启动成功!
​Active: active (running) since 六 -- :: CST; 18min ago
.测试 在浏览器打开192.168.44.:/index.php
看到 hello eric 就大功告成~ 设置开机自启动服务
systemctl enable php-fpm.service
systemctl enable nginx.service
如项目框架为lavarel,则配置文件可用下面这个:
server {
listen 80;
server_name learn.laravel5.com;
root /var/www/html/learnlaravel5/public;
index index.html
index.php;
location / {
try_files $uri $uri/
/index.php$is_args$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include fastcgi_params;
}
}

centos7.3安装php7.0的更多相关文章

  1. centos7下编译安装php-7.0.15(PHP-FPM)

    centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...

  2. Linux Centos7.2 编译安装PHP7.0.2

    操作环境: 1.系统:Centos7.2 2.服务:Nginx 1.下载PHP7.0.2的安装包解压,编译,安装: $ cd /usr/src/ $ wget http://cn2.php.net/d ...

  3. Centos7 离线安装 php7

    问题:因内部管控,机器无法连接公有yum源安装php. 正常安装php7可以参考CentOS7.2 安装 PHP7.2 下面的代码也是一种方法 yum -y install libmcrypt lib ...

  4. Centos7 编译安装PHP7

    Centos7 编译安装PHP7 编译安装的方式可以让组件等设置更加合理,但需要你对PHP的代码及各种配置非常的熟悉,以下为大致的安装流程,大家可以参考 1.下载编译工具 yum groupinsta ...

  5. CentOS7编译安装php7.1配置教程详解

    这篇文章主要介绍CentOS7编译安装php7.1的过程和配置详解,亲测 ,需要的朋友可以参考. 1.首先安装依赖包: yum install libxml2 libxml2-devel openss ...

  6. Linux安装php-7.0.16,完成php和apache的配置

    Linux安装php-7.0.16,完成php和apache的配置     版本:php-7.0.16.tar.gz,libxml2-2.9.2.tar.gz(php需要它的支持,首先安装它) 说明 ...

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

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

  8. CentOS7离线安装MySQL8.0

    CentOS7离线安装MySQL8.0 卸载软件 rpm -e --nodeps 要卸载的软件包 root@jacky zookeeper]# rpm -e --nodeps java-1.6.0-o ...

  9. centos7.5环境下编译安装php7.0.30并安装redis和mongo扩展

    .安装php7..30的脚本 # vim install_php.sh #!/bin/bash # 安装基本依赖 yum install -y gcc gcc-c++ htop telnet ioto ...

随机推荐

  1. vue项目 预览照片的插件 v-viewer

    查看图片主要使用的旋转.翻转.缩放.上下切换.键盘操作等功能都有. 1.首先是安装 npm install v-viewer --save 2.安装完在main.js里面引用(还要记得引用它的css样 ...

  2. 【HiJ1m】在NOIP2017前写过的有用的东西汇总

    http://www.cnblogs.com/Elfish/p/7544623.html 高级树状数组 http://www.cnblogs.com/Elfish/p/7554420.html BST ...

  3. tp volist需要便利两个数组时的处理办法

    你需要便利两个数组,并且需要使用key 和value的试的时候,volist是否先得有些捉鸡? 我们可以便利其中一个数组,而另一个利用数组的指针来操作 next($arr) 将数组指针下移 key($ ...

  4. -bash: wget 未找到命令的解决办法

    在Linux操作系统中,我们会经常要用到wget下载文件.wget非常稳定,它在带宽很窄的情况下和不稳定网络中有很强的适应性. 在linux中使用wget时,若报-bash: wget: comman ...

  5. Nutch2 WebPage写入数据库的过程分析

    版本: Nutch 2.2.1 本文通过InjectJob来追踪webpage的定义.创建.传递.序列化.写入数据库的整个过程.从源码中摘录了重要的代码行,并标明其所在文件名.行号. 1. 定义 sc ...

  6. js获取当地时间并且拼接时间格式的三种方式

    js获取当地时间并且拼接时间格式,在stackoverflow上有人在问,查了资料,各种方法将时间格式改成任意自己想要的样式. 1. var date = new Date(+new Date()+8 ...

  7. 初识BeeFramework

    由于近期的项目须要,Hybrid开发成为我開始学习的新知识.非常早之前就了解到两个开发框架--BeeFramework 和 Samurai,可是由于本人一直没有闲暇去研究,所以就一直搁置一旁了.近期才 ...

  8. LeetCode——Pascal's Triangle II

    Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3 ...

  9. SSH公钥认证

    一.实验的目的 了解密钥对的创建和使用,掌握免password远程登录和远程操作 二.实验环境 本地主机 rh1: 192.168.233.3/24 远程主机 rh2: 192.168.233.4/2 ...

  10. .net中的目录

    System.Environment.CurrentDirectory Application.StartupPath https://msdn.microsoft.com/en-us/library ...