Last active
December 30, 2016 13:54
-
-
Save joshlevinson/d90ffab3ea61393e91c2 to your computer and use it in GitHub Desktop.
Create new VVV sites with WP CLI + wildcard hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create at /etc/dnsmasq.d/dev in the vagrant guest | |
address=/dev/127.0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [email protected] |
@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
Wildcard DNS on your local machine (host) is a nice thing to add to this.
You can follow this guide.
Step 2 is different though: we want Dnsmasq to forward traffic to VVV, not the host.
Accomplish this by switching out
address=/dev/127.0.0.1
with the address of the VVV machine (usually192.168.50.4
, soaddress=/dev/192.168.50.4
) in the/usr/local/etc/dnsmasq.conf
file.