• 安装php

php下载地址

# 避免出错,先安装下面
yum install libzip libzip-devel libxml2-devel openssl openssl-devel bzip2 bzip2-devel curl-devel libjpeg-devel libpng libpng-devel freetype-devel gmp-devel readline-devel libxslt-devel # 下载
wget https://www.php.net/distributions/php-7.3.11.tar.gz # 解压
tar -zxvf php-7.3.11.tar.gz cd /data/source/php-7.3.11 # 编译
./configure \
--prefix=/usr/local/php7\
--with-config-file-path=/usr/local/php7/conf\
--enable-fpm\
--with-fpm-user=www\
--with-fpm-group=www\
--disable-rpath\
--enable-soap\
--with-libxml-dir\
--with-xmlrpc\
--with-openssl\
--with-mhash\
--with-pcre-regex\
--with-zlib\
--enable-bcmath\
--with-bz2\
--enable-calendar\
--with-curl\
--enable-exif\
--with-pcre-dir\
--enable-ftp\
--with-gd\
--with-openssl-dir\
--with-jpeg-dir\
--with-png-dir\
--with-zlib-dir\
--with-freetype-dir\
--enable-gd-jis-conv\
--with-gettext\
--with-gmp\
--with-mhash\
--enable-mbstring\
--with-onig\
--with-mysqli=mysqlnd\
--with-pdo-mysql=mysqlnd\
--with-zlib-dir\
--with-readline\
--enable-shmop\
--enable-sockets\
--enable-sysvmsg\
--enable-sysvsem \
--enable-sysvshm \
--with-libxml-dir\
--with-xsl\
--enable-zip\
--with-pear\
--enable-wddx # 编译的时候,可能会有各种未知错误出现。直接百度就好,基本都很容易找到解决方案 # 安装
make && make install
  • 配置php

# 将源码包配置文件拷贝到安装目录
mkdir -p /usr/local/php7/conf
cp php.ini-development /usr/local/php7/conf/php.ini # 拷贝php-fpm配置文件
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf # 添加用户
groupadd www
useradd -g www www
  • 设置php-fpm开机启动

vi /lib/systemd/system/php-fpm.service

内容如下,路径改成自己的php路径

[Unit]
Description=php-fpm
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/php7/sbin/php-fpm
PrivateTmp=true
[Install]
WantedBy=multi-user.target
# 设置开机启动
systemctl enable php-fpm.service # 停止开机自启动
systemctl disable php-fpm.service # 启动nginx服务
systemctl start php-fpm.service  # 停止服务
systemctl stop php-fpm.service  # 重新启动服务
systemctl restart php-fpm.service  # 查看所有已启动的服务
systemctl list-units --type=service # 查看服务当前状态
systemctl status php-fpm.service
  • 配置nginx解析php

vi /usr/local/nginx/conf/nginx.conf

# 内容如下
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} # 重启nginx就可以了

centos7 搭建 php7 + nginx (2)的更多相关文章

  1. centos7 搭建 php7 + nginx (1)

    前言 曾今,写过几篇类似的文章,但是发现几个月后,自己回头再看的时候,有种支离破碎的感觉.自己写的并不全,所以今天打算写一篇比较详细的文档.争取下次环境的减的时候,只需要拷贝复制粘贴即可完成环境搭建. ...

  2. 阿里云centos7搭建php+nginx环境

    阿里云Centos搭建lnmp(php7.1+nginx+mysql5.7) https://jingyan.baidu.com/article/215817f7a10bfb1eda14238b.ht ...

  3. Mac下使用brew搭建PHP7+nginx+mysql开发环境

    http://blog.csdn.net/mysteryhaohao/article/details/52230634 HomeBrew brew的安装,直接上官网:http://brew.sh/ 一 ...

  4. CentOS7搭建FastDFS+Nginx

    1. FastDFS 介绍 FastDFS是一个开源的分布式文件系统,她对文件进行管理,功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等,解决了大容量存储和负载均衡的问题.特别适合以文件 ...

  5. centos7 搭建keepalived+Nginx+tomcat

    准备1台 192.168.2.224  安装Nginx,2台安装tomcat   192.168.2.222   192.168.2.223 1.安装Nginx: 上传pcre-8.36.tar.gz ...

  6. centos7+python3.6+nginx+uwsgi+django2的搭建笔记

    公司需上线一套python编写的代码,需要给搭建一套环境  ,本次采用centos7+python3.6+nginx+uwsgi2+django2+mysql5.7的方式来进行搭建 写在部署前 在线上 ...

  7. Centos7 搭建Nginx+rtmp+hls直播推流服务器

    1 准备工具 使用yum安装git [root~]# yum -y install git 下载nginx-rtmp-module,官方github地址 // 通过git clone 的方式下载到服务 ...

  8. centos7.x下环境搭建(二)—nginx安装

    上篇文章是对mysql的安装,接着上篇文章,这篇文章安装nginx服务 添加yum源 默认情况Centos7中无Nginx的源,最近发现Nginx官网提供了Centos的源地址.因此可以如下执行命令添 ...

  9. virtualBox安装centos7并配置nginx php mysql运行环境

    virtualBox安装centos7并配置nginx php mysql运行环境 一:virtualBox安装centos7并进行基础设置 1.下载dvd.iso安装文件,下载地址:https:// ...

随机推荐

  1. Codeforces 1166B - All the Vowels Please

    题目链接:http://codeforces.com/problemset/problem/1166/B 个元音. 思路:先判断能否弄出至少5*5的行列,然后按顺序填字符串就好了. AC代码: #in ...

  2. 关于pycharm总是以测试的形式运行程序(nosetest)

    由于各种原因,pycharm有test字段,或者有test的函数时,会莫名奇妙的进入test模式,有时候怎么也跳不出来,害我花了半天时间,坑. 解决办法:直接在菜单栏找Run,选择不带test的进行运 ...

  3. Day 7 :一句话Python(匿名函数-lambda,三元运算,列表表达式,生成器表达式)

    注意: 1.所有的列表表达式都可以转换成生成器表达式 2.经量让标傲世简化你得操作,增加代码可读性 3.如果代码过于复杂,应该转换成普通代码 4.再代码中尽可能多使用生成器表达式. 三元运算符:简化代 ...

  4. javascript es6 语法快速入门

    1. let.const 作用:let 声明变量,const 声明常量 与 var 的区别:不能重复声明,且存在块级作用域,即只在代码块内生效 2. 箭头函数 使用: let show = funct ...

  5. Caused by: java.io.FileNotFoundException: class path resource [com/cxy/springboot/mapping/] cannot be resolved to URL because it does not exist

    java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.conte ...

  6. netty UnpooledHeapByteBuf 源码分析

    UnpooledHeapByteBuf 是基于堆内存进行内存分配的字节缓冲区,没有基于对象池技术实现,这意味着每次I/O的读写都会创建一个新的UnpooledHeapByteBuf,频繁进行大块内存的 ...

  7. apache 80 端口 反向代理 tomcat 8080端口

    最近有个jsp的项目要放到服务上,但服务器上已经有了XAMPP(apache + mysql + php), 已占用了80端口.但http默认是访问80端口的. 先把tomcat 环境搭建起来, 发现 ...

  8. bootsrap-----固定布局解析

    <div class="container"> container </div> .container { .container-fixed();容器的wi ...

  9. leetcode-240-搜索二维矩阵②

    题目描述: 最佳方法:O(m+n) O(1) class Solution: def searchMatrix(self, matrix, target): if not matrix : retur ...

  10. 单独编译和使用webrtc音频增益模块(附完整源码+测试音频文件)

    webrtc的音频处理模块分为降噪ns和nsx,回音消除aec,回声控制acem,音频增益agc,静音检测部分.另外webrtc已经封装好了一套音频处理模块APM,如果不是有特殊必要,使用者如果要用到 ...