VVV,自定义站点URL重定向到仪表板

时间:2017-07-19 13:53:44

标签: wordpress nginx vagrant vvv-wordpress

我刚刚使用Vagrant和Virtual Box安装和设置了VVV,基础级别的所有内容都运行良好。

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

我正在使用vagrant-hostsupdater,因此主机文件正在为我填充以及vagrant-triggers。

非常感谢任何帮助!

编辑:我在我的hosts文件中注意到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 Hosts File

1 个答案:

答案 0 :(得分:0)

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

  root {vvv_path_to_site}/public_html;

希望它有所帮助。