docker制作php5.4运行环境镜像

1.下载镜像

docker pull centos:7

或者在控制面板下

2.运行centos7镜像的容器,edncenos7 是新生成的容器名称

## --name 新名字
docker run -it --name edncenos7 c9a1fdca3387 /bin/bash

 3.在容器内下载php5.4等插件,以便提交成为新镜像

wget --no-check-certificate  https://www.php.net/distributions/php-5.4.45.tar.gz

 运行报错,找不到wget,先使用yum install 安装一下,然后重新运行第3步

 4.下载完成,您可以使用以下命令解压源码:

tar -xf php-5.4.45.tar.gz

5.安装编译PHP所需的依赖项。在CentOS 7上,您可以使用以下命令来安装这些依赖项

yum install -y gcc make zlib-devel libxml2-devel openssl-devel bzip2-devel

6.进入解压后的PHP源码目录,并执行以下命令来配置编译选项:

#进入目录
cd php-5.4.45

#编译安装
./configure --prefix=/usr/local/php --with-config-file-path=/etc/php --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --with-mysql --with-mysqli --with-pdo-mysql --with-openssl --enable-mbstring --enable-zip --enable-gd-native-ttf --enable-ftp --enable-gd-native-ttf --with-curl --with-xmlrpc --enable-sockets --enable-intl

 configure: error: cannot guess build type; you must specify one

解决方案我们指定一下build值,在上面的命令中加入下面的代码 --build=arm-linux 重新执行

##error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/
yum -y install curl-devel

##error: Unable to detect ICU prefix or no failed.  Please verify ICU install prefix and make sure icu-config works.
yum install libicu-devel

##error: C++ preprocessor "/lib/cpp" fails sanity check
yum install glibc-headers
yum install gcc-c++

其他错误从下面的地址里找答案,或者百度下都能解决本文不做过多说明

php源代码安装常见错误与解决办法分享_php技巧_脚本之家

linux编译安装时常见错误解决办法_icu-config-CSDN博客

 看到这个提示就代表配置成功了

 7.使用以下命令进行编译和安装:

make
make install

二、安装nginx 

#nginx 依赖的一些 lib 库:
yum install gcc-c++ 
yum install pcre pcre-devel 
yum install zlib zlib-devel 
yum install openssl openssl--devel

#检查一下安装已有的 nginx
find -name nginx

#如果系统安装了Nginx,那么卸载
yum remove nginx

#然后开始安装,首先进入 /usr/local 目录
cd /usr/local

#下载安装包
wget -c http://nginx.org/download/nginx-1.12.1.tar.gz

#解压
tar -zxvf nginx-1.12.1.tar.gz

2.使用 --prefix 参数指定 nginx 安装的目录,make、make install 安装

wget --no-check-certificate  https://github.com/cfsego/file-md5/archive/master.zip

像我就没法直接下载 

  修改一下hosts文件

vi /etc/hosts  

20.205.243.166 github.com

如果不能安装,文件我放到文章最后了可以自己去下然后传到自己的镜像里

 3.解压文件

unzip file-md5-master.zip

4.编译配置项

#创建nginx用户
#设置shell不能登陆,不创建家目录
useradd -s /bin/nologin -M nginx

#编译配置
./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --with-http_ssl_module --add-module=file-md5-master --with-debug

nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/var/run/nginx/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "/var/tmp/nginx/client"
  nginx http proxy temporary files: "/var/tmp/nginx/proxy"
  nginx http fastcgi temporary files: "/var/tmp/nginx/fastcgi"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp" 

5. 编译安装

make
make install

启动和停止 nginx

cd /usr/local/nginx/sbin 
./nginx 
./nginx -s stop
 ./nginx -s quit 
./nginx -s reload 
./nginx -s quit

 成功

相关推荐

  1. Docker jenkins 镜像制作

    2023-12-22 09:28:05       62 阅读
  2. docker制作zookeeper镜像

    2023-12-22 09:28:05       35 阅读
  3. Linux制作docker镜像

    2023-12-22 09:28:05       26 阅读
  4. tengine-docker镜像制作

    2023-12-22 09:28:05       33 阅读
  5. Docker镜像制作之ZLMediakit镜像制作

    2023-12-22 09:28:05       54 阅读
  6. docker构建alpine镜像时,运行环境坑。

    2023-12-22 09:28:05       25 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-22 09:28:05       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-22 09:28:05       100 阅读
  3. 在Django里面运行非项目文件

    2023-12-22 09:28:05       82 阅读
  4. Python语言-面向对象

    2023-12-22 09:28:05       91 阅读

热门阅读

  1. SpringBoot整合SpringDataJpa QueryDSL和原生态SQL

    2023-12-22 09:28:05       65 阅读
  2. 网络安全基础

    2023-12-22 09:28:05       40 阅读
  3. 面试算法67:最大的异或

    2023-12-22 09:28:05       53 阅读
  4. 蓝桥杯-每日刷题-024

    2023-12-22 09:28:05       49 阅读
  5. API文档生成工具-----Knife4介绍

    2023-12-22 09:28:05       77 阅读
  6. Liunx服务器查看程序的日志命令

    2023-12-22 09:28:05       49 阅读
  7. Ceph基本环境配置

    2023-12-22 09:28:05       64 阅读
  8. LeetCode 每日一题 Day 19 || 前后缀和分解&单调栈

    2023-12-22 09:28:05       70 阅读
  9. ImageProcessing,ComputerVision,DeepLearning中的名词

    2023-12-22 09:28:05       61 阅读
  10. LVS虚拟服务器

    2023-12-22 09:28:05       65 阅读