centos7 搭建 php7 + nginx (2)
安装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)的更多相关文章
- centos7 搭建 php7 + nginx (1)
前言 曾今,写过几篇类似的文章,但是发现几个月后,自己回头再看的时候,有种支离破碎的感觉.自己写的并不全,所以今天打算写一篇比较详细的文档.争取下次环境的减的时候,只需要拷贝复制粘贴即可完成环境搭建. ...
- 阿里云centos7搭建php+nginx环境
阿里云Centos搭建lnmp(php7.1+nginx+mysql5.7) https://jingyan.baidu.com/article/215817f7a10bfb1eda14238b.ht ...
- Mac下使用brew搭建PHP7+nginx+mysql开发环境
http://blog.csdn.net/mysteryhaohao/article/details/52230634 HomeBrew brew的安装,直接上官网:http://brew.sh/ 一 ...
- CentOS7搭建FastDFS+Nginx
1. FastDFS 介绍 FastDFS是一个开源的分布式文件系统,她对文件进行管理,功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等,解决了大容量存储和负载均衡的问题.特别适合以文件 ...
- 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 ...
- centos7+python3.6+nginx+uwsgi+django2的搭建笔记
公司需上线一套python编写的代码,需要给搭建一套环境 ,本次采用centos7+python3.6+nginx+uwsgi2+django2+mysql5.7的方式来进行搭建 写在部署前 在线上 ...
- Centos7 搭建Nginx+rtmp+hls直播推流服务器
1 准备工具 使用yum安装git [root~]# yum -y install git 下载nginx-rtmp-module,官方github地址 // 通过git clone 的方式下载到服务 ...
- centos7.x下环境搭建(二)—nginx安装
上篇文章是对mysql的安装,接着上篇文章,这篇文章安装nginx服务 添加yum源 默认情况Centos7中无Nginx的源,最近发现Nginx官网提供了Centos的源地址.因此可以如下执行命令添 ...
- virtualBox安装centos7并配置nginx php mysql运行环境
virtualBox安装centos7并配置nginx php mysql运行环境 一:virtualBox安装centos7并进行基础设置 1.下载dvd.iso安装文件,下载地址:https:// ...
随机推荐
- Solrj API读取core 索引库数据
private static String zkHost = "ip:2181,ip:2181,ip:2181"; private static CloudSolrServer s ...
- nutch二次开发环境搭建
开发环境: ubuntu14.04 + jdk1.7 + eclispe +nutch1.7 1:解压下好nutch1.7 src 源码(wget http://archive.apache.org/ ...
- python 在机器学习中应用函数
浅述python中argsort()函数的用法 (1).先定义一个array数据 1 import numpy as np 2 x=np.array([1,4,3,-1,6,9]) (2).现在我们可 ...
- Vue项目中同级组件传值的例子
大家好,今天给大家带来Vue项目中同级组件之间传值的例子,父子组件之间的通信比较简单,这里不做讨论. 假设该项目中的需求如下: 图中左上角有一个按钮,我们的需求是点击它时,侧边导航栏收缩且主界面放大, ...
- Android代号、版本及API级别之间的对应关系
参考链接:Codenames, Tags, and Build Numbers | Android Open Source Project
- 在Logstash的配置文件中对日志事件进行区分
1.多个日志文件作为输入源 input { # 通过给日志事件定义类型来区分 file { path => ["/var/log/nginx/access.log"] typ ...
- CentOS 7 下配置 Nginx + PHP7.1 + MariaDB 以及 Laravel 框架
<!doctype html> CentOS 7 下配置 Nginx + PHP7.1 + MariaDB 以及 Laravel 框架.mdhtml {overflow-x: initia ...
- vc枚举本机端口信息
关于查看本机端口信息,可能大多数人都知道在cmd下的netstat 命令,殊不知该命令在底层也是调用相关api来实现的,相关函数有:GetTcpTableGetExtendedTcpTableGetU ...
- Python学习笔记(五)——异常处理
Python 异常总结 异常名称 解释 AssertionError 断言语句(assert)失败:当assert关键字后边的条件为假时,程序将抛出该异常,一般用于在代码中置入检查点 OSError ...
- vagrant centos lamp小记
更新包 sudo yum -y update vagrant centos 默认语言好像是德语,看不懂,需要更换为 en_US [vagrant@localhost ~]$ locale LANG=d ...