0

我刚刚使用 Vagrant 和 Virtual Box 安装并设置了 VVV,基础级别的一切都运行良好。

根据他们的示例,我尝试添加自定义站点,但是当我导航到自定义站点的 URL(vvvtest.dev) 时,我会被发送到 VVV 仪表板,而不是新站点的 WP 安装过程。

我正在使用 vagrant-hostsupdater 以便为我和 vagrant-triggers 填充主机文件。

任何帮助将不胜感激!

编辑:我在我的主机文件中注意到 vvvtest.dev 指向与 vvv 和 vvv.dev 相同的位置(sim 链接?),请参见屏幕截图。我在配置期间哪里出错了?

我的 vvv-custom.yml 文件存储在主文件夹(vagrant-local)中:

sites:
  # The wordpress-default configuration provides a default installation of the
  # latest version of WordPress.
  wordpress-default:
    repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-default.git
    hosts:
      - local.wordpress.dev

  # The wordpress-develop configuration is useful for contributing to WordPress.
  wordpress-develop:
    repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-develop.git
    hosts:
      - src.wordpress-develop.dev
      - build.wordpress-develop.dev

  # Custom Install Test
  vvvtest:
    hosts:
      - vvvtest.dev    

  # The following commented out site configuration will create a standard WordPress
  # site in www/example-site/ available at http://my-example-site.dev.

  #example-site:
  #  repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
  #  hosts:
  #    - my-example-site.dev

  # The following commented out site configuration will create a environment useful
  # for contributions to the WordPress meta team:

  #wordpress-meta-environment:
  #  repo: https://github.com/WordPress/meta-environment.git

utilities:
  core:
    - memcached-admin
    - opcache-status
    - phpmyadmin
    - webgrind

我的 nginx.conf 文件存储在 www/vvvtest/provision 中:

server {
  listen 80;
  listen 443 ssl;
  server_name vvvtest.dev;
  root {vvv_path_to_site};

  error_log {vvv_path_to_site}/log/error.log;
  access_log {vvv_path_to_site}/log/access.log;

  set $upstream {upstream};

  include /etc/nginx/nginx-wp-common.conf;
}

我的 vvv-init.sh 文件,存储在 www/vvvtest/provision

#!/usr/bin/env bash

# Add the site name to the hosts file
echo "127.0.0.1 ${VVV_SITE_NAME}.local # vvv-auto" >> "/etc/hosts"

# Make a database, if we don't already have one
echo -e "\nCreating database '${VVV_SITE_NAME}' (if it's not already there)"
mysql -u root --password=root -e "CREATE DATABASE IF NOT EXISTS ${VVV_SITE_NAME}"
mysql -u root --password=root -e "GRANT ALL PRIVILEGES ON ${VVV_SITE_NAME}.* TO wp@localhost IDENTIFIED BY 'wp';"
echo -e "\n DB operations done.\n\n"

# Nginx Logs
mkdir -p ${VVV_PATH_TO_SITE}/log
touch ${VVV_PATH_TO_SITE}/log/error.log
touch ${VVV_PATH_TO_SITE}/log/access.log

# Install and configure the latest stable version of WordPress
cd ${VVV_PATH_TO_SITE}
if ! $(wp core is-installed --allow-root); then
  wp core download --path="${VVV_PATH_TO_SITE}" --allow-root
  wp core config --dbname="${VVV_SITE_NAME}" --dbuser=wp --dbpass=wp --quiet --allow-root
  wp core multisite-install --url="${VVV_SITE_NAME}.local" --quiet --title="${VVV_SITE_NAME}" --admin_name=admin --admin_email="admin@${VVV_SITE_NAME}.local" --admin_password="password" --allow-root
else
  wp core update --allow-root
fi

主机文件: Windows 主机文件

4

1 回答 1

0

在您的 www/vvvtest/provision/nginx.conf 文件中,也许您可​​以尝试将根目录修改为:

  root {vvv_path_to_site}/public_html;

希望能帮助到你。

于 2017-08-19T15:40:42.433 回答