[英]Docker Wordpress Setup with Volume for Theme Folder
I created a setup for a wordpress installation with docker-compose:我使用 docker-compose 为 wordpress 安装创建了一个设置:
version: '3'
services:
db:
image: mysql:8.0
container_name: db
restart: unless-stopped
env_file: .env
volumes:
- dbdata-dev:/var/lib/mysql
command: '--default-authentication-plugin=mysql_native_password'
networks:
- rn-dev-network
wordpress:
depends_on:
- db
image: wordpress:5.5.3-fpm-alpine
container_name: wordpress
restart: unless-stopped
env_file: .env
environment:
- WORDPRESS_DB_HOST=db:3306
- WORDPRESS_DB_USER=$MYSQL_USER
- WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
- WORDPRESS_DB_NAME=$MYSQL_DATABASE
volumes:
- ./wordpress/wp-content:/var/www/html/wp-content
- ./wordpress/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
- wordpress-dev:/var/www/html
networks:
- rn-dev-network
webserver:
depends_on:
- wordpress
image: nginx:1.15.12-alpine
container_name: webserver
restart: unless-stopped
ports:
- "80:80"
volumes:
- wordpress-dev:/var/www/html
- ./nginx-conf:/etc/nginx/conf.d
networks:
- rn-dev-network
volumes:
wordpress-dev:
dbdata-dev:
networks:
rn-dev-network:
driver: bridge
Via FTP, I moved a theme into the wp-content/themes folder.通过 FTP,我将一个主题移动到 wp-content/themes 文件夹中。 The theme shows up on wordpress when starting the container, but it does not show any preview picture and is missing all pictures/assets when loading it.
主题在启动容器时显示在 wordpress 上,但不显示任何预览图片,并且在加载时丢失所有图片/资产。
I don't see what is missing.我看不出缺少什么。 When I ssh into the container and check the folder, the volume is correctly linked and the wordpress theme is showing up in the correct folder.
当我通过 ssh 进入容器并检查文件夹时,该卷已正确链接并且 wordpress 主题显示在正确的文件夹中。
You need to mount the image file to the nginx container, because static content is served via the nginx container.您需要将图像文件挂载到 nginx 容器,因为静态内容是通过 nginx 容器提供的。 The Php container only executes the php.
Php 容器只执行 php.ini 文件。
webserver:
depends_on:
- wordpress
image: nginx:1.15.12-alpine
container_name: webserver
restart: unless-stopped
ports:
- "80:80"
volumes:
- wordpress-dev:/var/www/html
- ./wordpress/wp-content:/var/www/html/wp-content
- ./nginx-conf:/etc/nginx/conf.d
networks:
- rn-dev-network
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.