将wordpress网站迁移到docker容器(本地)

时间:2019-12-20 12:52:05

标签: wordpress docker docker-compose

我正在尝试将Wordpress网站迁移到docker容器中,以制作我的网站的副本,并对要测试的内容进行测试。当我加载数据库脚本时出现问题。

docker-compose.yml

version: "3.7"
services:
   db:
image: mysql:5.7
restart: always
environment:
  MYSQL_ROOT_PASSWORD: toor
  MYSQL_DATABASE: wordpress
  MYSQL_USER: wordpress
  MYSQL_PASSWORD: wordpress
networks: 
  - mynetwork1
volumes:
  - ./mylocalfolderdb:/docker-entrypoint-initdb.d/

wordpress:
image: wordpress:4.9.8
ports:
  - 8111:80
restart: always
depends_on:
  - db
environment:
  WORDPRESS_DB_HOST: db:3306
  WORDPRESS_DB_USER: wordpress
  WORDPRESS_DB_PASSWORD: wordpress
networks: 
  - mynetwork1
volumes:
  - ./mylocalforlderwp:/var/www/html

phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
  - 8222:80
restart: always
depends_on: 
  - db
environment:
  PMA_HOST: db:3306
  MYSQL_ROOT_PASSWORD: toor
networks:
  - mynetwork1

networks: 
mynetwork1:

volumes:
mylocalfolderwp:
mylocalfolderdb:

mylocalfolderdb 卷中,有一个sql脚本可以加载我的数据库。在 mylocalfolderwp 卷中,有多个Wordpress文件夹和文件(带有插件和主题)。

在sql脚本的末尾执行此命令以更新路由:

UPDATE 8S2rzU_options SET option_value = replace(option_value,"https://myOnlineSite.es","http://127.0.0.1")
 WHERE option_name = "home" OR option_name = "siteurl";
 UPDATE 8S2rzU_posts SET guid = replace(guid,"https://myOnlineSite.es","http://127.0.0.1");
 UPDATE 8S2rzU_posts SET post_content = replace(post_content,"https://myOnlineSite.es","http://127.0.0.1");
 UPDATE 8S2rzU_postmeta SET meta_value = replace(meta_value,"https://myOnlineSite.es","http://127.0.0.1");
 UPDATE 8S2rzU_bp_activity SET action = replace(action,"https://myOnlineSite.es","http://127.0.0.1");
 UPDATE 8S2rzU_bp_activity SET primary_link = replace(primary_link, "https://myOnlineSite.es","http://127.0.0.1");
 UPDATE 8S2rzU_bp_activity SET content = replace(content,"https://myOnlineSite.es","http://127.0.0.1");
 UPDATE 8S2rzU_bp_activity_meta SET meta_value = replace(meta_value,"https://myOnlineSite.es","http://127.0.0.1");
 UPDATE 8S2rzU_bp_user_blogs_blogmeta SET meta_value = replace(meta_value, "https://myOnlineSite.es","http://127.0.0.1");

现在我去127.0.0.1:8111,它没有用,它使我抛出MIME异常,并且没有任何Wordpress。

enter image description here

我试图修改.htaccess文件,禁用数据库中的插件和主题,但是这些对我来说都不起作用。现在不知道该怎么办。

如果我禁用插件,主题警告就不会出现,这很令人费解。 如果我输入localhost:8111/wp-admin,则会显示空白页。

如果您需要更多信息,请问我。

0 个答案:

没有答案