查看“Nginx+php-fpm docker镜像合二为一”的源代码
←
Nginx+php-fpm docker镜像合二为一
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
进阶见 [[Alpine#alpine lnmp 也为docker准备]] https://github.com/evan886/alpine-dockerbuild/tree/main/alpine_nginx_php7.4 <pre> 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 </pre> =troubleshooting= <pre> 为什么老是 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 </pre> =my wordpress= <pre> 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 </pre> 访问 http://192.168.88.70:32500/wordpress/wp-admin/setup-config.php http://wp.linuxsa.org/wordpress/wp-admin/setup-config.php == TKE yaml== <pre> apiVersion: apps/v1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: "1" description: wp测试 creationTimestamp: "2021-09-04T08:45:03Z" generation: 1 labels: k8s-app: wordpress qcloud-app: wordpress managedFields: - apiVersion: apps/v1 manager: tke-apiserver operation: Update time: "2021-09-04T08:45:03Z" - apiVersion: apps/v1 manager: kube-controller-manager operation: Update time: "2021-09-04T08:45:12Z" name: wordpress namespace: default resourceVersion: "511239899" selfLink: /apis/apps/v1/namespaces/default/deployments/wordpress uid: 254856f1-2f61-49e8-9d70-a577a69a87ce spec: progressDeadlineSeconds: 600 replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: k8s-app: wordpress qcloud-app: wordpress strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 0 type: RollingUpdate template: metadata: creationTimestamp: null labels: k8s-app: wordpress qcloud-app: wordpress spec: containers: - env: - name: PATH value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - name: PHPIZE_DEPS value: "autoconf \t\tdpkg-dev dpkg \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkgconf \t\tre2c" - name: PHP_INI_DIR value: /usr/local/etc/php - name: PHP_EXTRA_CONFIGURE_ARGS value: --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi - name: PHP_CFLAGS value: -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - name: PHP_CPPFLAGS value: -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - name: PHP_LDFLAGS value: -Wl,-O1 -pie - name: GPG_KEYS value: 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 - name: PHP_VERSION value: 7.4.22 - name: PHP_URL value: https://www.php.net/distributions/php-7.4.22.tar.xz - name: PHP_ASC_URL value: https://www.php.net/distributions/php-7.4.22.tar.xz.asc - name: PHP_SHA256 value: 8e078cd7d2f49ac3fcff902490a5bb1addc885e7e3b0d8dd068f42c68297bde8 image: ccr.ccs.tencentyun.com/evan/k8s:wpv5.8 imagePullPolicy: IfNotPresent name: wp resources: limits: cpu: 500m memory: 1Gi requests: cpu: 250m memory: 256Mi securityContext: privileged: false terminationMessagePath: /dev/termination-log terminationMessagePolicy: File dnsPolicy: ClusterFirst imagePullSecrets: - name: qcloudregistrykey restartPolicy: Always schedulerName: default-scheduler securityContext: {} terminationGracePeriodSeconds: 30 status: availableReplicas: 1 conditions: - lastTransitionTime: "2021-09-04T08:45:12Z" lastUpdateTime: "2021-09-04T08:45:12Z" message: Deployment has minimum availability. reason: MinimumReplicasAvailable status: "True" type: Available - lastTransitionTime: "2021-09-04T08:45:03Z" lastUpdateTime: "2021-09-04T08:45:12Z" message: ReplicaSet "wordpress-5977dc5976" has successfully progressed. reason: NewReplicaSetAvailable status: "True" type: Progressing observedGeneration: 1 readyReplicas: 1 replicas: 1 updatedReplicas: 1 </pre> =see also= [https://www.cnblogs.com/xiao987334176/p/12960500.html nginx+php-fpm docker镜像合二为一] [https://cloud.tencent.com/developer/article/1636417 on qcloud nginx+php-fpm docker镜像合二为一] [https://blog.csdn.net/technofiend/article/details/51067005 docker中nginx容器和php容器混合运行] [https://www.php.cn//php-weizijiaocheng-406246.html 为多个PHP-FPM容器量身打造单一Nginx镜像的方法] [https://blog.csdn.net/firehive/article/details/82112296 基于Alpine构建php7.0.27镜像的dockerfile] [https://www.jianshu.com/p/b5428d0b1651 Alpine(apk add)从零搭建 php7.2-fpm + nginx] [https://blog.csdn.net/weixin_30240349/article/details/96914608 使用 docker 搭建 nginx+php-fpm 环境 (两个独立镜像)] [[category:php]] [[category:devops]]
返回至
Nginx+php-fpm docker镜像合二为一
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
我的导航
关于我
shell
python
ops
linuxchina.net
blog.linuxchina
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息