首页 运维 云计算 查看内容

Docker 制作 php7.1+nginx 镜像

2019-11-18 09:19 |来自: 互联网 2599 0

摘要: 1、拉去镜像docker pull ubuntu:18.042、创建容器docker run -d -it --name test ubuntu:18.04-d 守护进程-it (-t: 在新容器内指定一个伪终端或终端。-i: 允许你对容器内的标准输入 (STDIN) 进行交互。)test 容器 ...
关键词: 容器 目录 index proxy 文件 会报 ubuntu nginx 宿主机 终端

1、拉去镜像

docker pull ubuntu:18.04

2、创建容器

docker run -d -it --name test ubuntu:18.04

�9�9-d 守护进程
�9�9-it (-t: 在新容器内指定一个伪终端或终端。-i: 允许你对容器内的标准输入 (STDIN) 进行交互。)
�9�9test 容器名称

3、Ubuntu18.04 安装 PHP7.1

4、Composer 安装
注意:PHP 项目使用 composer update 时,更新不了,可能会报错。

Update failed (The zip extension and unzip command are both missing, skipping.

由于 zip 没有安装导致,安装即可

5、nginx 安装

apt install nginx

Nginx 配置文件

注意:
如果网站目录 run 的时候 - v 映射到容器中。需要与 nginx.conf 中 user www-data; 文件组用户一致。
更改目录 file 拥有者与组

chown -R www-data:www-data file

�9�9-R 处理目录以及目录下所有文件
�9�9file 目录

宿主机 nginx 反向代理

server {
listen 80;
server_name app.test;
index index.html index.htm index.php;

location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8010;
proxy_redirect off;
}

}

本文出处: https://www.toutiao.com/a6760183376235217415/
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部