将 VPS 上 drupal 网站迁移到 docker,导入数据库后网站打不开.求大家指导

2020-01-19 17:13:20 +08:00
 programV2
以下是我的操作步骤: (请 V 友们帮我看看怎么排查问题, 弄了两天了还是搞不定, 谢谢

1.在 VPS 上的运行 Docker 环境,配置(php7.2+mysql5.7+ngninx1.12)环境, docker compose 好后上传一个全新的 drupal8 安装包安装测试,安装过程中没有出现异常提示, 说明环境搭建正常。
2. 安装时设置网站和数据库信息,将本地所有文件和目录按原结构上传到 docker 相应容器挂载目录,mysql 将备份数据库文件导入;
3. 修改 /sites/default/settings.php 文件中的数据库用户名、数据库表、数据库密码。

谢谢大家, 祝大家春节快乐!
2079 次点击
所在节点    程序员
52 条回复
manami
2020-01-19 17:17:22 +08:00
More detail…看日志报错信息,一些目录文件的写入 /读取权限是否给了?修改配置文件后是否重启了相关服务?
sleepm
2020-01-19 17:23:28 +08:00
你把报错贴出来才能帮你排查问题
programV2
2020-01-19 17:33:37 +08:00
@manami 谢谢. 相关目录及文件权限都给了, 也重启了好几次,
@sleepm 谢谢. 浏览器报错如下, 一会我把日志贴上来,

An error occurred.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.
gefranks
2020-01-19 17:38:37 +08:00
看下 aceess log,ngnix 默认的网页是不是设好了 在 nginx.conf 里
manami
2020-01-19 17:43:51 +08:00
@programV2 看 nginx 日志,不是页面错误信息。或者,开 ssh 让我上去看看 / 狗头
programV2
2020-01-20 17:30:11 +08:00
谢谢 V 友们, @gefranks @manami @sleepm 虽然我重新搭建导入数据库后网站可以打开, 但由于原来老网站开启了 reCAPTCHA 模块, 旧域名弃用了, 现在进不了后台了, 连后台密码也忘记了, 我访问容器登陆数据库尝试关闭模块, 执行 UPDATE system SET status = 0 WHERE name = "recaptcha"; 出现如下错误 :

ERROR 1146 (42S02): Table 'drupal.system' doesn't exist,

我的数据库名 是 drupal , 是我这个命令写错了吗?

另外请教 V 友们 你们是如何在 docker 上安装 drush 的, 谢谢!
sleepm
2020-01-20 20:32:08 +08:00
这个错误是说 drupal.system 这个表不存在,也就是你可能没有把数据库恢复回去
或者你进 mysql 之后没有执行 use drupal;
数据库基础。。。
sleepm
2020-01-20 20:40:02 +08:00
一步一步把你不懂的东西,转换成你懂的东西,就比如英文报错,慢慢你就能自己找到解决方法
programV2
2020-01-20 20:55:10 +08:00
@sleepm 谢谢 V 友指点, 但我执行了 mysql -u user -p drupal 已经选中了数据库呀

我第一次接触 Drupal 并且官方文档没有 docker 内容,网上关于这个的内容也很少,找不到一个可以参考的,
sleepm
2020-01-20 21:17:43 +08:00
那你就看看 docker 的知识吧。。重点不是 drupal on docker,是 docker
programV2
2020-01-20 21:29:33 +08:00
@sleepm 请问 Drupal 关闭 recaptcha 模块是在 System 这个表吗?如何查看在哪个 table 关闭 recaptcha 模块?
programV2
2020-01-20 21:34:16 +08:00
@sleepm 确认已经有把数据库恢复回去了,不然网站上内容都会是空的,现在是由于这个 recaptcha +忘了后台密码就进不了后台的
programV2
2020-01-20 21:58:55 +08:00
@sleepm 查看文档也是用 UPDATE system SET status = 0 WHERE name = "recaptcha"; 不知道为什么提示表名不存在? system table 有不同的名称?
merryfreespace
2020-01-21 05:01:10 +08:00
For D8:

1. remove module
2. truncate table cache_config
sleepm
2020-01-21 07:56:38 +08:00
不要看网站有内容数据库就恢复回去了,你要在 mysql 里 show tables;
drupal 我不懂,但是 docker 我知道
programV2
2020-01-21 09:58:56 +08:00
@merryfreespace thank you for your help. in this case i would like to disable captcha module manually in the database, reCaptcha has blocked me out of admin panel of my website, now i have access to my server and database thru SSH, when i ran command:
UPDATE system SET status = 0 WHERE name = "recaptcha";

Seeing an error
“ERROR 1146 (42S02): Table 'drupal.system' doesn't exist,


When i ran the following command to show table , i can not find the table named "system" of 131 rows in set:
select table_name from information_schema.tables where table_schema='drupal' and table_type='base table';

So wondering if I use the right table name? how to find the exact system table name to disable captcha module in Drupal ? my Drupal version is 8.5.5 Thank you very much.
programV2
2020-01-21 10:02:09 +08:00
@merryfreespace when i ran command to show database, it looks like :
| information_schema |
| drupal |
+--------------------+
2 rows in set
programV2
2020-01-21 12:54:37 +08:00
@sleepm 谢谢🙏我运行 show database :
| information_schema |
| drupal |
+--------------------+
2 rows in set


然后 show table 没有看到任何包含 System 的记录,这个可能是什么原因呢?
sleepm
2020-01-21 13:19:09 +08:00
大哥
mysql> show tables;
如果列出来有 system 那就看下面的
drush cache-clear
http://alejandro.bio/node/113
programV2
2020-01-21 13:59:06 +08:00
@sleepm 是的, 我就是执行 show tables; 没有看到任何包含 System 的记录,这个可能是什么原因呢?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/639219

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX