Objective
This article is to introduce the use of Docker to make nginx+php mirror image, the mirror in this article is CentOS + nginx 1.9.7 + PHP 5.6.14, the following words do not say more directly to see the implementation of the steps.
1, first download to Nginx and PHP:
nginx-1.9.5.tar.gz Download: http://nginx.org/en/download.html
php-5.6.14.tar.gz Download: >http://php.net/downloads.php
2, and expansion package so:
Memcache-2.2.4.tgz
Redis's PHP so package download here: >https://github.com/nicolasff/phpredis/zipball/master
3, first installs the Yum the third party source:
wget http://www.atomicorp.com/installers/atomic
Sh./atomic
Installation steps
The first step is to use Docker CentOS mirroring as the basis
In the second step, Yum installs a whole bunch of required packages:
Yum install-y openssh-clients
yum install-y gcc gcc-c++ kernel-devel yum install-y pcre pcre-devel zlib zlib-de
Vel OpenSSL openssl-devel
yum install-y php-mcrypt libmcrypt libmcrypt-devel yum install-y libxml2 libxml2-deve
L
Yum install-y bzip2 bzip2-devel
yum install-y curl-devel yum install-y libjpeg.x86_64 libpng.x86_64 freet
ype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64
Yum install-y Libjpeg-turbo-devel libjpeg-turbo-static libjpeg-turbo-utils
yum install-y libc-client.x86_64 Yum
- Y uw-imap-devel
yum install-y libxslt-devel
yum install-y zip unzip autoconf
The third step is to install Nginx:
./configure--with-http_ssl_module
Nginx after installation, the installation directory is:/usr/local/nginx
See what modules Nginx install to use the command:
/usr/local/nginx/sbin/nginx-v
Step fourth, install 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- 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-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-xml--enable-shmop--enable-session--enable-ctype--with-iconv-dir--with-iconv
After the installation of PHP, the installation directory is:/usr/local/php
The fifth step is to install memcache PHP Extensions:
Download Address: >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
The sixth step is to install Redis PHP Extensions:
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
The seventh step is to install MongoDB PHP Extensions:
Download Address: >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
Php/bin/phpize
./configure--enable-mongo--with-php-config=/usr/local/php/bin/php-config make
&& Make install
Eighth step, PHP to join Memcache, Redis, MongoDB Extended Support:
Open/usr/local/php/etc/php.ini, add extension:
Extension = redis.so
extension = memcache.so
extension = mongo.so
Complete.
Report:
To reduce the size of the mirrored package, use the command to clear the installation package when the installation is complete:
More PHP Expansion packs can be downloaded here:
>https://pecl.php.net/packages.php
To start the PHP-FPM command:
/usr/local/php/sbin/php-fpm-c/usr/local/php/etc/php.ini-y/usr/local/php/etc/php-fpm.conf
To start the Nginx command:
/usr/local/nginx/sbin/nginx
The Docker start command is:
Docker Run-dt--name nginx-php--privileged=true-v/home/www/nginx_logs:/usr/local/nginx/logs-v Local/nginx/html-p 80:80-p 443:443 img-nginx-php
Summarize
The above is the use of Docker to make nginx+php mirror all the steps, I hope the content of this article for everyone's study or work to bring some reference value, if you have questions you can message exchange.