Skip to content

Instantly share code, notes, and snippets.

@joshlevinson
Last active December 30, 2016 13:54
Show Gist options
  • Save joshlevinson/d90ffab3ea61393e91c2 to your computer and use it in GitHub Desktop.
Save joshlevinson/d90ffab3ea61393e91c2 to your computer and use it in GitHub Desktop.
Create new VVV sites with WP CLI + wildcard hosts
# create at /etc/dnsmasq.d/dev in the vagrant guest
address=/dev/127.0.0.1
# create in your vagrant directory @ config/nginx/sites/wildcard.conf
# this dir is copied during provision, if you don't want to re-provision, run this in a vagrant shell:
# sudo rsync -rvzh --delete /srv/config/nginx-config/sites/ /etc/nginx/custom-sites/
server {
listen 80;
listen 443 ssl;
server_name ~^(?<name>.*)\.dev;
root /srv/www/$name/htdocs;
include /etc/nginx/nginx-wp-common.conf;
}
vagrant ssh
cd /srv/www/
mkdir site-name && cd site-name && mkdir htdocs && cd htdocs
wp core download
wp core config --dbname=site-name --dbuser=root --dbpass=root
wp db create
wp core install --url=site-name.dev --title=Site --admin_user=admin --admin_pass=password --admin_email=admin@example.dev
@allenmoore
Copy link

@joshlevinson This is great! I made a couple of changes, which can be seen here -- https://gist.github.com/allenmoore/a7a231a385537285c180899b44d5e16e.

The most important would be replacing --admin_pass=password with --admin_password=password on line 7 of wp-cli-commands.sh.

You'll also notice some additional commands on line 3 of the same file that creates both vvv-hosts and wp-cli.yml files, with the correct content added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment