需求:在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. LD_DEBUG

    LD_DEBUG 是 glibc 中的 loader 为了方便自身调试而设置的一个环境变量.通过设置这个环境变量,可以方便的看到 loader 的加载过程. LD_DEBUG=help ./main ...

  2. Codeforces 667B Coat of Anticubism

    链接:传送门 题意:题目balabala说了一大堆,然而并没什么卵用,给你n个数,将这个集合分割成两部分,构成三角形的两个边,让你求补充的那个边最短是多长 思路:三角形三边具有 a + b > ...

  3. 【NOI2001】食物链

    [NOI2001]食物链 题意 动物王国中有三类动物 A,B,C,这三类动物的食物链构成了有趣的环形.A 吃 B,B 吃 C,C 吃 A. 现有 N 个动物,以 1 - N 编号.每个动物都是 A,B ...

  4. 2019-03-19 SQL Server简单存储过程的创建 删除 执行

    --创建名为 Get 的有输入参数的存储过程 create proc Get --设置默认值 @TrustId int ='001' as begin select * from [DealStruc ...

  5. jboss <context /> 配置虚拟路径,映射本地文件

    这个目录下的server.xml <host><host/>标签中添加: <Context path="/file" docBase="D: ...

  6. Manacher(最大回文字串)

    很好的讲解 注意两端的字符要不同,同时数组要开大一些 [Manacher]最长回文子串 #include<bits/stdc++.h> #define REP(i, a, b) for(r ...

  7. fensorflow 安装报错 DEPENDENCY ERROR

    1.错误信息 DEPENDENCY ERROR The target you are trying to run requires an OpenSSL implementation. Your sy ...

  8. [terry笔记]python FTP

    如下是作业,用python做一个ftp,主要利用socket. server端在linux下运行,在client端可以执行shell命令(静态的) 在client端输入get xxx,即可下载. 在c ...

  9. linux /proc/cpuinfo 文件描写叙述

    processor :系统中逻辑处理核的编号.对于单核处理器.则课觉得是其CPU编号,对于多核处理器则能够是物理核.或者使用超线程技术虚拟的逻辑核 vendor_id :CPU制造商 cpu fami ...

  10. kentico version history and upgrade

    Version history Kentico 10: November 30, 2016 Kentico 9: November 24, 2015 Kentico 8.2: January 6, 2 ...