• Docker Nginx1.21 + PHP7.4 部署


    1、PHP7.4 容器配置

    #1. 启动PHP7.4
    docker run --restart=always --name myphp-docker -v ~/nginx/www:/www -d php:7.4-fpm
    
    #2.登录PHP7.4容器
    docker exec -it myphp-docker bash
    
    #3.更新APT仓库 先做备份:
    mv /etc/apt/sources.list /etc/apt/sources.list.bak
    echo "deb http://mirrors.163.com/debian/ stretch main non-free contrib" >/etc/apt/sources.list
    echo "deb http://mirrors.163.com/debian/ stretch-proposed-updates main non-free contrib" >>/etc/apt/sources.list
    echo "deb-src http://mirrors.163.com/debian/ stretch main non-free contrib" >>/etc/apt/sources.list
    echo "deb-src http://mirrors.163.com/debian/ stretch-proposed-updates main non-free contrib" >>/etc/apt/sources.list
    
    #4.更新软件源
    apt update
    
    #5.安装各种库
    apt-get install --allow-downgrades -y  zlib1g=1:1.2.8.dfsg-5 zlib1g-dev libz-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev libwebp-dev libjpeg-dev
    
    #6.解压源码
    docker-php-source extract
    
    #7.进入gd源码文件夹
    cd /usr/src/php/ext/gd
    
    #8.准备编译
    docker-php-ext-configure gd --with-webp=/usr/include/webp --with-jpeg=/usr/include  --with-freetype=/usr/include/freetype2
    
    #9.编译安装 
    docker-php-ext-install -j$(nproc) gd
    
    #10.安装其他需要的PHP组件
    docker-php-ext-install pdo_mysql mysqli mbstring
    
    #11.检查扩展是否安装成功
    php -m | grep gd
    #12.退出php容器终端
    exit
    #13.重启php容器
    ……
    

    2、Nginx容器配置

    docker run --restart=always --name nginx-php -p 8080:80 -p 8090-8099:8090-8099 -d 
        -v ~/nginx/www/:/usr/share/nginx/html:ro 
        -v ~/nginx/conf/conf.d:/etc/nginx/conf.d:ro 
        --link myphp-docker:php 
        nginx:1.21
    
  • 相关阅读:
    [Python+OpenCv]近似图像差异检测
    解决github登录不上
    aws 知识汇总
    ansible work 案例
    git命令
    Google Chrome浏览器离线安装包下载方式
    物理机U盘安装银河麒麟linux操作系统注意事项
    微信云函数的创建与配置
    CentOS6.5升级OpenSSH版本
    linux下oracle数据库定时备份
  • 原文地址:https://www.cnblogs.com/desultory-essay/p/15156567.html
Copyright © 2020-2023  润新知