Nginx+php-fpm docker镜像合二为一
跳到导航
跳到搜索
进阶见 Alpine#alpine lnmp 也为docker准备
https://github.com/evan886/alpine-dockerbuild/tree/main/alpine_nginx_php7.4
docker build -t evan886/alpine_nginx_php7.4:v3.14 . docker push evan886/alpine_nginx_php7.4:v3.14 docker run -it --name alpine_nginx_php7.3 -p 80:80 alpine_nginx_php7.3:1 . docker run -it --name alpine_nginx_php7.3 -p 80:80 id 域名 默认为wp.linuxsa.org 目录其实就是 /var/www/html 还有个 docker pull evan886/wp:v5.8 docker build -t evan886/wp:v5.8 . tree . . ├── Dockerfile ├── usage └── wordpress-5.8-zh_CN.tar.gz cat Dockerfile FROM evan886/alpine_nginx_php7.4:v3.14 #ADD default.conf /etc/nginx/conf.d/ ADD wordpress-5.8-zh_CN.tar.gz /var/www/html/ RUN chown www-data:www-data -R /var/www/html docker run --name wp -p80:80 -d 54254a4fbae1 http://wp.linuxsa.org/wordpress/wp-admin/setup-config.php
troubleshooting
为什么老是 403呢 403 Forbidden ng 配置 添加 index.php 放在 第二位 c3 (cannot be forced) - image has dependent child images 要先删除 wp 注意 al ng include 没开启到我要的defaul 上面说在3.15会开启 现在开的默认的是报错的 nginx.conf 放太多server 拷贝到容器中 docker cp test.php alpine_nginx_php7.3:/var/www/html/ docker cp evan.php some-nginx:/var/www/html
my wordpress
cat aliyun/ng-dp.yaml apiVersion: apps/v1 kind: Deployment metadata: name: my-nginx spec: replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: evan886/wp:v5.8 ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: ngx-service labels: app: nginx spec: type: NodePort selector: app: nginx ports: - port: 80 targetPort: 80 nodePort: 32500
see also
on qcloud nginx+php-fpm docker镜像合二为一
基于Alpine构建php7.0.27镜像的dockerfile