• 安装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 1166A - Silent Classroom

    题目链接:http://codeforces.com/problemset/problem/1166/A 思路:统计所有首字母出现的次数,由贪心可知对半分最少. AC代码: #include<i ...

  2. 剑指offer——05重建二叉树

    题目描述 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树.假设输入的前序遍历和中序遍历的结果中都不含重复的数字.例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7, ...

  3. USACO2008 Time Management /// 贪心 oj24386

    题目大意: 有N个工作被编号为1..N (1 ≤ N ≤ 1,000) 完成第i个工作需要T_i (1 ≤ T_i ≤ 1,000)的时间 第i个工作需在S_i (1 ≤ S_i ≤ 1,000,00 ...

  4. flask-Local源码流程解析

    flask中Local源码数据类型首先明确:源码中要构造的数据类型数是这样的: __storage__ = { 用线程或者协程的唯一标识为键: {stack:[ctx(session/request) ...

  5. Rsync 参数

    # rsync -v, --verbose 详细模式输出 -q, --quiet 精简输出模式 -c, --checksum 打开校验开关,强制对文件传输进行校验 -a, --archive 归档模式 ...

  6. html编写的日历

    1.html (1) <html> <head> <meta http-equiv="Content-Type" content="text ...

  7. LightOJ 1342 Aladdin and the Magical Sticks 期望(结论题)

    题目传送门 题意:n根木棍,每根木棍都有一个权值,木棍有可识别的木棍和不可识别的木棍,每次抽取木棍时,会累加权值,如果是可识别的木棍就不放回,不可识别的木棍就放回,问每根木棍至少被抽取一次,权值的期望 ...

  8. 调整VMware中虚拟机中Linux系统屏幕分辨率的问题

    即:解决显示底部菜单栏以及安装软件中没有下一步的按钮用Tab键的问题 右击打开终端,输入以下命令: Xrandr Xrandr -s  1280x720 (自己选择一个分辨率即可) 原文:https: ...

  9. 使用CompletionService批处理任务(线程池阻塞线程)

    CompletionService ExecutorService BlockingQueueFuture 如果你向Executor提交了一个批处理任务,并且希望在它们完成后获得结果.为此你可以保存与 ...

  10. 十二. for of 示例 (可以解决大多数应用场景)

    for of entries() 可以同时拿到数组的索引跟值 因此可以使用解构的语法: for of 示例 1. 求和 2.字符串