In the command line, I used vv create
to make a new WordPress multisite, selecting "y" on the multisite option during setup. Once the process finished, the site was created, but was the network had not been setup. I went into the wp-config file, and added /* Multisite */
define( 'WP_ALLOW_MULTISITE', true );
to get the network option in the admin area. Now I am stuck though, because while setting up the network it shows "Warning: An existing WordPress network was detected. Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables." above the code blocks to enable the network. Furthermore, while I am able to add code to the wp-config file, there is not an .htaccess file available...and I am thinking it may not be needed to create one. I have not found much documentation on it online, but what I have seen seems to suggest these requirements are handled another way. Can someone help me figure out how to get multisite setup? I feel I'm missing something very simple that everybody knows except me, and not discussing it online...how embarrassing.
1 Answer
You need the VVV Custom site template to enable multisite. And you have to let the main Vagrant instance load it automatically.
Open the vvv-config.yml
in the main directory, under sites:
add the following entry:
msvagrant:
repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template
hosts:
- msvagrant.dev
- en.msvagrant.dev
- de.msvagrant.dev
custom:
wp_type: subdomain
Then run vagrant up
, and it should install this multisite with two subdomains.
You will need access to nginx' error logs. They aren't accessible by default, because even as root user, you cannot read anything that directory. :/
In order to fix that, move to the directory provision/
and create a file named vvv-nginx.conf
there. Add the following content to it:
server {
listen 80;
listen 443 ssl;
server_name {{DOMAINS_HERE}};
root {vvv_path_to_site}/public_html;
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;
}
This will create a directory log/
in every site's root directory with error.log
and access.log
in it.
-
thanks for the info, but I'm confused, because I cannot find an existing vvv-config.yml file in any of the directories. You mentioned "you have to let the main Vagrant instance load it automatically", is there a command which does this? On my desktop, I have a file structure vagrant-local/www/my-sites. Is the vagrant-local file the "main directory" you are referring to, or possibly the www or the my-site folder? Sorry if I'm being a noob, I appreciate your help.– JakeCommented Jun 20, 2017 at 10:32
-
-
!image of my folder. This is my vagrant-local folder, which apparently does not have the vvv-config.yml file.– JakeCommented Jun 20, 2017 at 11:08