Docker安装Nginx1.11.10+php7+MySQL
Docker安装php-fpm
1.编辑Dockerfile
FROM php:7.1.3-fpm
ADD sources.list /etc/apt/sources.list
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN apt-get update && apt-get install -y \
vim \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libmagickwand-dev \
libmagickcore-dev \
imagemagick \
&& docker-php-ext-install -j$(nproc) iconv mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
RUN pecl install imagick-3.4.3 && docker-php-ext-enable imagick
RUN docker-php-ext-install pdo_mysql mysqli
2.同级目录下创建sources.list 使用163源
[root@git php7]# cat sources.list
deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
3.构建本地镜像
docker build -t php:7.1.3-fpm-chao .
4.构建php-fpm容器
docker run --name some-php -v /srv/www:/var/www/html -v /srv/php/php.ini:/usr/local/etc/php/php.ini -d php:7.1.3-fpm-chao
5./srv/php/php.ini 目前仅设置了时区后期可以自己添加其他
######设置PHP的时区
date.timezone = PRC
Docker安装Nginx
1.创建nginx的配置文件及映射路径
mkdir -p /srv/nginx vim nginx.conf user nginx;
worker_processes 1; error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid; events {
worker_connections 1024;
} http {
include /etc/nginx/mime.types;
default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on;
#tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf;
} mkdir conf.d && cd conf.d
vim default.conf
server {
listen 80;
server_name localhost; #charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main; location / {
root /var/www/html;
index index.html index.htm;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /var/www/html;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
2.构建nginx容器
docker run --name some-nginx -p 80:80 --link some-php:php-fpm -v /etc/localtime:/etc/localtime:ro -v /srv/nginx/logs:/var/log/nginx -v /srv/nginx/nginx.conf:/etc/nginx/nginx.conf -v /srv/nginx/conf.d:/etc/nginx/conf.d --volumes-from some-php -d nginx
Docker安装MySQL
docker run --name some-mysql -v /etc/localtime:/etc/localtime:ro -v /etc/mysql/conf.d/mysql.cnf:/srv/mysql/mysql.cnf -v /etc/mysql/mysql.conf.d/mysqld.cnf:/srv/mysql/mysqld.cnf -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 -d mysql:5.7.17
Docker安装Nginx1.11.10+php7+MySQL的更多相关文章
- ubuntu下安装nginx1.11.10
(本页仅作为个人笔记参考) 为openssl,zlib,pcre配置编译 wget http://om88fxbu9.bkt.clouddn.com/package/nginx/nginx-1.11. ...
- ubuntu docker安装与部署java,mysql,nginx镜像
docker 安装与部署java,mysql,nginx docker 配置 安装docker $ sudo apt-get remove docker docker-engine docker.io ...
- linux centos7.3安装lnmp,nginx-1.11.12 ,php7.0.2 ,
#更新源 yum -y update #添加用户和组 adduser www groupadd www usermod -G www www #初始化目录 mkdir -p /data/app/php ...
- 心动不如行动,基于Docker安装关系型数据库PostgrelSQL替代Mysql
原文转载自「刘悦的技术博客」https://v3u.cn/a_id_171 最近"全栈数据库"的概念甚嚣尘上,主角就是PostgrelSQL,它最近这几年的技术发展不可谓不猛,覆盖 ...
- centos6.5生产环境编译安装nginx-1.11.3并增加第三方模块ngx_cache_purge、nginx_upstream_check、ngx_devel_kit、lua-nginx
1.安装依赖包 yum install -y gcc gcc-c++ pcre-devel openssl-devel geoip-devel 2.下载需要的安装包 LuaJIT-2.0.4.zip ...
- centos 6.8 安装 nginx-1.11.4
yum -y install gcc-c++ wget http://nginx.org/download/nginx-1.11.4.tar.gz wget https://www.openssl. ...
- [macOS] macOS下,VirtualBox安装CentOS7.4, 搭建nginx, mysql, PHP5.6&PHP7.1
准备工作 网络设置 相关教程:http://www.jianshu.com/p/e6ba699b5992 ifcfg-enp0s3配置 TYPE=Ethernet BOOTPROTO=dhcp DEF ...
- CentOS Docker安装 && docker 基础指令
1 # 直接从官网下载docker的安装命令包(docker已经很贴心将安装shell脚本帮我们准备好了) 2 curl -fsSL get.docker.com -o get-docker.sh 3 ...
- Docker(一):Docker安装
简介 Docker是dotcloud公司开源的一款产品,主要基于PAAS平台为开发者提供服务.是解决运行环境和配置问题软件容器,方便做持续集成并有助于整体发布的容器虚拟化技术. Docker组件 ...
随机推荐
- 小白的Python之路 day5 hashlib模块
hashlib模块 一.概述 用于加密相关的操作,3.x里代替了md5模块和sha模块,主要提供 SHA1, SHA224, SHA256, SHA384, SHA512 ,MD5 算法 二.算法的演 ...
- (Release Candidate)Candidate
RC:(Release Candidate)Candidate是候选人的意思,用在软件或者操作系统上就是候选版本
- Spring Boot实战:拦截器与过滤器
一.拦截器与过滤器 在讲Spring boot之前,我们先了解一下过滤器和拦截器.这两者在功能方面很类似,但是在具体技术实现方面,差距还是比较大的.在分析两者的区别之前,我们先理解一下AOP的概念,A ...
- uwsgi wsgi nginx centos7.2部署flask
请原谅我比较懒,直接粘贴onenote笔记了 方法一测试完成后,建议用方法三:uwsgi,ginx部署
- TF-卷积函数 tf.nn.conv2d 介绍
转自 http://www.cnblogs.com/welhzh/p/6607581.html 下面是这位博主自己的翻译加上测试心得 tf.nn.conv2d是TensorFlow里面实现卷积的函数, ...
- 安装新的int 9中断例程2
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
- webpack的四大核心概念
webpack中文文档:https://doc.webpack-china.org/concepts/ 一.Entry(入口) 1.单个入口(简写)语法 // 语法 entry: string|Arr ...
- Git初入
Git记录 使用git 也有一段时间了, git的入门级了解也就不再多说, 但平常使用中, 仍然会遇到很多问题, 在此记录一二. 在查资料的过程中, 发现了两个比较好的资料: 特别是第二个, 相当详细 ...
- SQL Server 2005的服务器角色(public)的问题
SQL Server 默认会有9个服务器角色,而且这些角色是不能删除和新增.修改的.关于这些角色相关介绍和权限,请参考 其中有一个特殊的角色public,任何登录都会属于该角色,它只拥有的权限是VIE ...
- SQL Server——存储过程
我想从下面几个方面大概的讲述下存储过程,可能有些知识点是你没有注意的,也可能有些知识点我不知道,欢迎大家指点指点.如有不足,欢迎指教! 存储过程概念 存储过程优点 存储过程的接口 存储过程的解析.编译 ...