• 安装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. 【收集+】DDR5 vs DDR4

    Advantages of Migrating to DDR5 DDR5 is the next evolution in DRAM, bringing a robust list of new fe ...

  2. POJ 1946 Cow Cycling

    Cow Cycling Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 2516   Accepted: 1396 Descr ...

  3. 归档和解档配合NSFile存储数据

    NSString *Name = @"yc"; //第一个常量NSDocumentDirectory表示正在查找沙盒Document目录的路径(如果参数为NSCachesDirec ...

  4. shell 命令 进程相关

     1. 进程标识号PID 唯一性 pid 为0    内核进程,linux内核创建 pid 为1    init进程,系统最早创建的进程,init是所有用户进程的祖先 2. 查看系统进程信息 (1)[ ...

  5. vue解决sass-loader的版本过高导致的编译错误

    Module build failed: TypeError: this.getResolve is not a function at Object.loader (E:\appEx\PreRese ...

  6. 树莓派3b+ 实现视频监控

    设备:树莓派3B+.Raspberry Pi Camera sudo raspi-config #启动camera sudo reboot #监测摄像头是否安装成功 raspistill -o ima ...

  7. mysql数据库优化思路

    1.设置合适的主键和索引. (1).设置主键和索引的字段尽量不要选取经常修改的字段,同时索引的个数一般不宜超过6个: (2).sql语句中like  “%str%” 不支持索引, "str% ...

  8. 基于Element-UI的el-table,input框输入实现排序功能

    最终效果如下 实现要求: 如果输入的内容不是非负整数,那么提示报错,并且将值变为输入前的内容: 如果输入正确,则当输入的内容发生改变并且失去焦点以后,触发事件,重新获取列表: 实现思路 使用原生的in ...

  9. win10 mysql5.7指定某个配置文件启动

    点击开始菜单,搜索cmd.exe,左击以管理员身份运行 C:\Users\Administrator>cd C:\Program Files\MySQL\MySQL Server 5.7\bin ...

  10. http://wiki.ros.org/navigation/Tutorials/RobotSetup

    http://wiki.ros.org/navigation/Tutorials/RobotSetup