Docker build Nginx + PHP

Source: Internet
Author: User
Tags docker run

1. Pull Mirror First:

docker pull php:7.2.3-fpmdocker pull nginx:1.13

2, run PHP image,/opt/app Store code:

docker run --name phpfpm -d -v /opt/app:/app php:5.6-fpm

3. Run the Nginx container:

Docker run--name nginx_server-d-P 80:80--link phpfpm:phpfpm-v/opt/nginx/nginx.conf:/etc/nginx/nginx.conf--volumes-          From phpfpm Nginx--link connect two containers together--volumes-from attach the PHPFPM mount code to nginx nginx configuration for PHP is as follows: Location ~. php$ {Root    /www;    Fastcgi_pass phpfpm:9000;   Fastcgi_index index.php;    Fastcgi_param Script_filename/app$fastcgi_script_name; Include Fastcgi_params;} In the Nginx container, view the environment variables: [email protected]:/# envphpfpm_name=/nginx_server/phpfpmhostname=8e3fae96d9fcphpfpm_env_ phpize_deps=autoconf dpkg-dev file g++ gcc libc-dev make pkg-config RE2CN Js_version=1.13.9.0.1.15-1~stretchphpfpm_port_9000_tcp_proto=tcpphpfpm_env_php_ini_dir=/usr/local/etc/phpnginx _version=1.13.9-1~stretchphpfpm_env_php_url=https://secure.php.net/get/php-7.2.3.tar.xz/from/this/mirrorphpfpm _ENV_PHP_LDFLAGS=-WL,-O1-WL,--hash-style=both-piepwd=/home=/rootphpfpm_env_php_cppflags=- Fstack-protector-strong-fpic-fpie-o2phpfpm_port_9000_tcp_addr=172.17.0.3phpfpm_port=tcp://172.17.0.3:9000phpfpm_env_php_md5=phpfpm_port_9000_tcp=tcp:// 172.17.0.3:9000term=xtermphpfpm_env_php_version=7.2.3shlvl=1phpfpm_env_php_sha256= B3a94f1b562f413c0b96f54bc309706d83b29ac65d9b172bc7ed9fb40a5e651fphpfpm_port_9000_tcp_port=9000phpfpm_env_php_ cflags=-fstack-protector-strong-fpic-fpie-o2path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/ binphpfpm_env_gpg_keys=1729f83938da44e27ba0f4d3dbdb397470d12172 b1b44d8f021e4e2d6021e995dc9ff8d3ee5af27fphpfpm_ ENV_PHP_EXTRA_CONFIGURE_ARGS=--ENABLE-FPM--with-fpm-user=www-data--with-fpm-group=www-dataphpfpm_env_php_asc_ Url=https://secure.php.net/get/php-7.2.3.tar.xz.asc/from/this/mirror_=/usr/bin/env

Docker build Nginx + PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.