需求:在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. [NOIPlus]斗地主

    毫无意义的一道题. 用pai[i]表示某种点数的牌的剩余量,used[i]表示单,对,三,四的出牌数,大力分类讨论,大力dfs即可...真奇葩... #include <iostream> ...

  2. [读书笔记] R语言实战 (十三) 广义线性模型

    广义线性模型扩展了线性模型的框架,它包含了非正态的因变量分析 广义线性模型拟合形式: $$g(\mu_\lambda) = \beta_0 + \sum_{j=1}^m\beta_jX_j$$ $g( ...

  3. [luogu] P2519 [HAOI2011]problem a (贪心)

    P2519 [HAOI2011]problem a 题目描述 一次考试共有n个人参加,第i个人说:"有ai个人分数比我高,bi个人分数比我低."问最少有几个人没有说真话(可能有相同 ...

  4. 我一不小心把ubuntu里的ps这样的命令删掉了,应该怎么重装呢

    sudo apt-get --reinstall install procps    

  5. 工具-VS使用GIT工具

    由于VS中集成了GIT插件,本机安装了GIT工具和TortoiseGit工具,造成在VS中GIT无法同步,于是将TortoiseGit卸载,再次启用VS中的GIT插件,重新初始化GIT文件夹,问题解决 ...

  6. jQuery fadeOut无效

    $(this).fadeOut("fast"), var nowele = $(this); nowele.fadeOut("fast")

  7. npm --save 选项作用

    npm --save 选项作用 学习了:https://segmentfault.com/q/1010000000403629 -save和save-dev可以省掉你手动修改package.json文 ...

  8. 叫号系统排队系统挂号系统实现(JAVA队列)

    关于队列,使用的地方很的多. 现实中有许多的样例. 比方医院的挂号系统,银行里的叫号系统,食堂里的排队打饭等等.市场上又这种排队取号的设备.他们的功能基本例如以下: 1.系统可联网联机统一发号.2.系 ...

  9. Gradle 编译多个project(包括多Library库project依赖)指导

    Gradle Android最新自己主动化编译脚本教程(提供demo源代码) 这篇文章我简单写了基于Gradle2.1 进行的android project和android library的编译实例, ...

  10. 37、ifconfig命令

    很多windows很熟悉ipconfig命令行工具.它被用来获取网络接口配置信息并对此进行改动.Linux系统拥有一个类似的工具,也就是ifconfig(interfaces config). 通常须 ...