【问题标题】:403 forbidden nginx on docker/ddev websitedocker/ddev 网站上的 403 禁止 nginx
【发布时间】: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```

【问题讨论】:

    标签: docker drupal wsl-2


    【解决方案1】:

    下一个通知应该是这样的:

    [notice] 执行安装任务:install_verify_database_ready

    可能是数据库宕机、未连接,或者访问数据有误

    检查drush状态:

    ddev exec drush st
    

    Drupal 版本:9.3.2
    网站 URI:http://my-drupal9-site.ddev.site
    数据库驱动程序:mysql
    数据库主机名:ddev-my-drupal9-site-db
    数据库端口:3306
    数据库用户名:db
    数据库名称:db
    数据库:已连接

    重现步骤,没有错误

    安装 brew

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    

    安装 ddev

    brew install drud/ddev/ddev
    

    启动容器

    cd ~/dockertests/
    
    mkdir my-drupal9-site
    cd my-drupal9-site
    ddev config --project-type=drupal9 --docroot=web --create-docroot
    ddev start
    ddev composer create "drupal/recommended-project"
    ddev composer require drush/drush
    ddev drush site:install -y
    ddev drush uli
    ddev launch
    # [success] Installation complete.  User name: admin  User password: XXXX
    

    再次安装drupal

    ddev exec drush site:install --account-name=admin --account-pass=admin
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-07
      • 2019-04-17
      • 1970-01-01
      • 1970-01-01
      • 2016-03-08
      • 2019-05-29
      相关资源
      最近更新 更多