【发布时间】:2022-01-11 15:54:55
【问题描述】:
我正在尝试使用 WSL2 使用带有 DDev 的 Docker 在本地部署一个站点。我已经让 phpMyAdmin 正常工作,并且我有一个 ddev url,但是当我尝试使用 ddev launch 和/或转到 http://sitename.ddev.site 时,我收到 403 错误。
到目前为止,我已尝试将 docroot 更改为 public,但没有成功。此外,我已经将 SSH 连接到 docker 容器中,并且所有适当的文件都在那里。我的目录层次结构看起来像(在 powershell 中使用 ls):
~/dev/project_name$ ls
composer.json composer.lock project_name public sites vendor
另外,这可能是一个单独的问题,可能不相关 - 但如果不是 - 当我运行 drupal 安装命令时:
ddev exec drush site:install --account-name=admin --account-pass=admin
我被要求提供数据库名称/驱动程序/用户名/密码/主机/端口 - 我不完全确定它希望我提供什么信息。我设法在 Docker 中找到了数据库信息,但显然我无法正确地为其提供正确的信息。输入输出:
Database name [drupal]:
> db
Database driver [mysql]:
> mysql
Database username [drupal]:
> db
Database password [drupal]:
> root
Database host [127.0.0.1]:
> localhost
Database port [3306]:
> 3306
[warning] Program UNKNOWN not found. Proceed if you have already created or emptied the Drupal database.
Do you want to continue? (yes/no) [yes]:
> yes
[notice] Starting Drupal installation. This takes a while.
[notice] Performed install task: install_select_language
[notice] Performed install task: install_select_profile
[notice] Performed install task: install_load_profile
[notice] Performed install task: install_verify_requirements
In install.core.inc line 971:
Database name field is required.
Database username field is required.
Resolve all issues below to continue the installation. For help configuring your database server, see the <a href="https://www.dr
upal.org/docs/8/install">installation handbook</a>, or contact your hosting provider.<div class="item-list"><ul><li>Failed to con
nect to your database server. The server reports the following message: <em class="placeholder">SQLSTATE[HY000] [2002] No such fi
le or directory</em>.<ul><li>Is the database server running?</li><li>Does the database exist or does the database user have suffi
cient privileges to create the database?</li><li>Have you entered the correct database name?</li><li>Have you entered the correct
username and password?</li><li>Have you entered the correct database hostname and port number?</li></ul></li></ul></div>
Failed to execute command drush site:install --account-name=admin --account-pass=admin: exit status 1```
【问题讨论】: