最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

利用Docker制作Nginx+PHP鏡像的步驟詳解

 更新時(shí)間:2016年10月18日 09:12:06   作者:橫渡  
Nginx是一個(gè)高性能的Web和反向代理服務(wù)器,它具有很多非常優(yōu)越的特性,那么這篇文章小編就分步驟向大家介紹如何利用Docker制作Nginx+PHP的鏡像,文章介紹的很詳細(xì),對(duì)大家具有一定的參考借鑒價(jià)值,有需要的朋友們下面來(lái)一起看看吧。

前言

這篇文章給大家介紹的是使用Docker制作nginx+php的鏡像,本文里的鏡像是centos + nginx 1.9.7 + php 5.6.14,下面話不多說(shuō),直接看實(shí)現(xiàn)的步驟吧。 

1、首先下載到nginx和php:

nginx-1.9.5.tar.gz  下載:http://nginx.org/en/download.html

php-5.6.14.tar.gz    下載:>http://php.net/downloads.php 

2、以及擴(kuò)展包so:

memcache-2.2.4.tgz

redis的php so包這里下載:>https://github.com/nicolasff/phpredis/zipball/master 

3、先安裝yum的第三方源:

wget http://www.atomicorp.com/installers/atomic
sh ./atomic

安裝步驟

第一步,使用docker centos鏡像為基礎(chǔ)

第二步,yum安裝一大堆需要的包:

yum install -y openssh-clients
yum install -y gcc gcc-c++ kernel-devel
yum install -y pcre pcre-devel zlib zlib-devel openssl openssl-devel
yum install -y php-mcrypt libmcrypt libmcrypt-devel
yum install -y libxml2 libxml2-devel
yum install -y bzip2 bzip2-devel
yum install -y curl-devel
yum install -y libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64
yum install -y libjpeg-turbo libjpeg-turbo-devel libjpeg-turbo-static libjpeg-turbo-utils
yum install -y libc-client.x86_64
yum install -y uw-imap-devel
yum install -y libxslt-devel
yum install -y zip unzip autoconf

第三步,安裝nginx:

./configure --with-http_ssl_module

nginx安裝完后,安裝目錄為:/usr/local/nginx

查看nginx安裝哪些模塊可以使用命令:

/usr/local/nginx/sbin/nginx -V

第四步,安裝php:

./configure --prefix=/usr/local/php --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr/local/libxml --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr/local/libpng --enable-gd-native-ttf --with-openssl --with-fpm-user=www --with-fpm-group=www --with-libdir=lib64 --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm --enable-xml --enable-shmop --enable-session --enable-ctype --with-iconv-dir --with-iconv

php安裝完后,安裝目錄為:/usr/local/php

第五步,安裝memcache的php擴(kuò)展:

下載地址:>https://pecl.php.net/package/memcache

tar -zvxf memcache-2.2.4.tgz
cd memcache-2.2.4
/usr/local/php/bin/phpize
./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config
make && make install

第六步,安裝redis的php擴(kuò)展:

wget https://github.com/nicolasff/phpredis/zipball/master -O php-redis.zip
unzip php-redis.zip
cd php-redis
/usr/local/php/bin/phpize
./configure --enable-redis --with-php-config=/usr/local/php/bin/php-config
make && make install

第七步,安裝mongodb的php擴(kuò)展:

下載地址:>https://pecl.php.net/package/mongo

wget https://pecl.php.net/get/mongo-1.6.11.tgz
tar -zvxf mongo-1.6.11.tgz
cd mongo-1.6.11
/usr/local/php/bin/phpize
./configure --enable-mongo--with-php-config=/usr/local/php/bin/php-config
make && make install

第八步,php加入memcache、redis、mongodb擴(kuò)展支持:

打開/usr/local/php/etc/php.ini,加入擴(kuò)展:

extension = redis.so
extension = memcache.so
extension = mongo.so

完成。

附:

為減小鏡像包的大小,安裝完后,使用命令清除安裝包:

make clean
yum clean all

更多的php擴(kuò)展包可以到這里下載:

>https://pecl.php.net/packages.php

啟動(dòng)php-fpm命令:

/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf

啟動(dòng)nginx命令:

/usr/local/nginx/sbin/nginx

docker啟動(dòng)命令為:

docker run -dt --name nginx-php --privileged=true -v /home/www/nginx_logs:/usr/local/nginx/logs -v /home/www/src:/usr/local/nginx/html -p 80:80 -p 443:443 img-nginx-php

總結(jié)

以上就是利用Docker制作Nginx+PHP鏡像的全部步驟,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作帶來(lái)一定的參考借鑒價(jià)值,如果有疑問大家可以留言交流。

相關(guān)文章

  • 利用Dockerfile制作java運(yùn)行環(huán)境的鏡像的方法步驟

    利用Dockerfile制作java運(yùn)行環(huán)境的鏡像的方法步驟

    這篇文章主要介紹了利用Dockerfile制作java運(yùn)行環(huán)境的鏡像的方法步驟,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-11-11
  • docker start啟動(dòng)容器后仍然exit狀態(tài)的解決

    docker start啟動(dòng)容器后仍然exit狀態(tài)的解決

    這篇文章主要介紹了docker start啟動(dòng)容器后仍然exit狀態(tài)的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-06-06
  • Centos7下安裝與卸載docker應(yīng)用容器引擎的方法

    Centos7下安裝與卸載docker應(yīng)用容器引擎的方法

    這篇文章主要介紹了Centos7下安裝與卸載docker應(yīng)用容器引擎的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-07-07
  • 在 docker 之間導(dǎo)出導(dǎo)入鏡像的方法

    在 docker 之間導(dǎo)出導(dǎo)入鏡像的方法

    本篇文章主要介紹了在 docker 之間導(dǎo)出導(dǎo)入鏡像的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-07-07
  • Docker格式化輸出命令:"docker?inspect?--format"?學(xué)習(xí)記錄

    Docker格式化輸出命令:"docker?inspect?--format"?學(xué)習(xí)記錄

    Docker?--format?參數(shù)提供了基于?Go模板?的日志格式化輸出輔助功能,并提供了一些內(nèi)置的增強(qiáng)函數(shù),這篇文章主要介紹了Docker格式化輸出命令:"docker?inspect?--format"?學(xué)習(xí)筆記,需要的朋友可以參考下
    2023-01-01
  • docker windows10 共享目錄掛載失敗的解決方案

    docker windows10 共享目錄掛載失敗的解決方案

    這篇文章主要介紹了docker windows10 共享目錄掛載失敗的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2021-03-03
  • Docker buildx構(gòu)建多平臺(tái)鏡像并推送到私有倉(cāng)庫(kù)的方法

    Docker buildx構(gòu)建多平臺(tái)鏡像并推送到私有倉(cāng)庫(kù)的方法

    這篇文章主要介紹了Docker buildx構(gòu)建多平臺(tái)鏡像并推送到私有倉(cāng)庫(kù),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-01-01
  • Linux 離線安裝docker的過(guò)程(一鍵式安裝)

    Linux 離線安裝docker的過(guò)程(一鍵式安裝)

    這篇文章主要介紹了Linux 離線安裝docker(一鍵式安裝)的方法,非常簡(jiǎn)單,具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-08-08
  • 使用docker?compose部署emqx集群的示例

    使用docker?compose部署emqx集群的示例

    這篇文章主要介紹了使用docker compose部署emqx集群,本文通過(guò)示例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-06-06
  • Docker之cAdvisor的安裝使用方式

    Docker之cAdvisor的安裝使用方式

    這篇文章主要介紹了Docker之cAdvisor的安裝使用方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-11-11

最新評(píng)論

留坝县| 视频| 安塞县| 宁化县| 山西省| 江口县| 清河县| 梧州市| 三明市| 蒲江县| 新宁县| 靖远县| 岢岚县| 甘孜| 贵定县| 东平县| 秦皇岛市| 增城市| 乌鲁木齐县| 婺源县| 西乡县| 宁河县| 遂川县| 抚顺县| 阿拉善左旗| 来凤县| 凭祥市| 昌宁县| 云南省| 滕州市| 平江县| 乡宁县| 彭泽县| 巴塘县| 天柱县| 永和县| 额敏县| 莎车县| 九江市| 青冈县| 文昌市|