问题
We are trying to to configure the DNS routing for our multisites under one EC2 instance.
Specifically we are setting up DEV, TEST, and UAT environments of a WordPress Multisite. We only just have 2 sites on this network; the main site and one network site.
Now I have successfully migrated a copy (using Duplicator Pro) of our production site (on a different EC2 instance) to our DEV and the WordPress Multisite works. We have set the wildcard entries on our route53 for this (will provide a screenshot later).
But when I migrated the same copy to TEST and UAT, the main site works but the network site is not working and only redirects to our DEV site.
Can you suggest the correct way of setting up the DNS and wildcards for this setup? Or it's not possible and should be on separate EC2 instances for each environment?
回答1:
Check your setting in wp_options
table for different environment. Whethere its set to dev URL or not.
select * from wp_options where option_name like 'siteurl';
OR
inside wp-config.php
define('WP_SITEURL','http://localhost/xyz');
it should be different for different environment. If possible give your URL sample.
You can use single EC2 for multiple wordpress instance. You have to set server configuration file to accept domain request under 80 or 443 port.
/etc/apache2/site-available/000-default.conf
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /var/www/html/project_name/public/
</VirtualHost>
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/project_name/public/
</VirtualHost>
<VirtualHost *:80>
ServerName www.abc.com
DocumentRoot /var/www/html/project_name1/public/
</VirtualHost>
<VirtualHost *:80>
ServerName abc.com
DocumentRoot /var/www/html/project_name1/public/
</VirtualHost>
来源:https://stackoverflow.com/questions/59539301/multiple-wordpress-multisite-under-one-ec2-instance-aws