Multiple WordPress Multisite under one EC2 instance (AWS) - wordpress

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?

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>

Related

WAMP server - How to host more Wordpress websites?

I want to host more WP sites on WAMP server at the same time.
How to do that?
I would recommend you to download XAMPP. Basically WordPress is built on PHP and XAMPP has support for PHP. First download it and configure it then go to the installation directory and go to xampp>htdocs> then make a new folder 'project' and then unzip the WordPress files in that folder. After that read the manual provided ant xampp's website and follow it. Basically you can build your WordPress website on Xampp.
EDIT
Oh sorry for not understanding the question properly.
Now do this.
step 1: host the different websites in htdocs/ folder in xampp. You can host many websites as you want.
step 2: Then go to xampp/apache/conf/httpd.conf and uncomment the line which says this. For uncomment delete the '#' character.
Include conf/extra/httpd-vhosts.conf
step 3: Go to xampp/apache/conf/extra/httpd-vhosts.conf
Create the setup like this
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/xampp"
ServerName xampp
#ServerAlias
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site1"
ServerName site1.com
ServerAlias www.site1.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site2"
ServerName site2.com
ServerAlias www.site2.com
</VirtualHost>
YES. You can make sub-folders in www and make different WP websites. But be careful with the database configuration. Installing WP does nothing but coping some PHP files to that specific folder. All the data is saved in database and inside that specific folder itself (E.g. config php files).

Home Page Wordpress on Free MAMP does not work

I have installed MAMP (free version) on my Mac and I see the Start Page but I have a problem:
I deployed wordpress but browser say unable to connect (basically I cannot see wordpress page in browser).
In Document Root if I put a static html file I am able to see it in the browser. I am also able to see wordpress administrative pages and all other pages but home page. I have 8888 and 8889 for php and mysql ports. I do not know how to debug the issues. php, apache and mysql do not report any particular problems.
I configured virtual hosts following this guide:
http://foundationphp.com/tutorials/vhosts_mamp.php
The strange thing when I put http://localhost:8888/mywebsite in the browser it is redirected to localhost/mywebsite.
In /etc/hosts I have:
127.0.0.1 localhost
In httpd.conf I activated:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
and in this file I have:
NameVirtualHost *:8888
<VirtualHost *:8888>
ServerAdmin myuser#gmail.com
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
ErrorLog "logs/mywebsite-error_log"
CustomLog "logs/mywebsite-access_log" common
</VirtualHost>
Hope someone could help.
I found the solution. After several debugging I found that this guide is correct: http://foundationphp.com/tutorials/vhosts_mamp.php
You need: 1. In /etc/hosts add your virtual hosts like:
127.0.0.1 localhost
127.0.0.1 mywebsite
before I only used localhost because I hoped to use this host in browser but I found it's required to define a new host like mywebsite.
In httpd.conf I activated:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
In this file I have:
ServerAdmin myuser#gmail.com
DocumentRoot "/Applications/MAMP/htdocs"
ServerName mywebsite
ErrorLog "logs/mywebsite-error_log"
CustomLog "logs/mywebsite-access_log" common

WordPress multisite setup as subdomain - wildcard DNS record setup

I am new to WP multisite environment. I want to setup multisite in my local Ubuntu 14.04 environment. I already have localhost for my main site configured as carbazarlocal.com and its running OK. When I go to Tools > Network Setup I can see two options - Sub-domain and Sub-directory. I want to setup my multisites as sub-domains like dealer1.carbazarlocal.com, dealer2.carbazarlocal.com etc.
On this page WordPress says "You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality". How to do this and where?
In /etc/hosts I have the following entry:
127.0.0.1 carbazarlocal.com
In /etc/apache2/apache2.conf I have the following:
<Directory /var/www/html/carbazar>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
In /etc/apache2/sites-available/carbazarlocal.com.conf I have this:
<VirtualHost *:80>
ServerAdmin admin#carbazarlocal.com
ServerName carbazarlocal.com
ServerAlias *.carbazarlocal.com
DocumentRoot /var/www/html/carbazar
</VirtualHost>
And in /var/www/html/carbazar/wp-config I have this:
define('WP_ALLOW_MULTISITE', true);
What else I need to do and where to complete the following step:
"You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality"?
If you use Apache server then ...
In the httpd.conf file, or in the include file containing the VirtualHost section for your web account, add a line like this (if it is not already present):
ServerAlias *.example.com
Also create a wildcard DNS record like:
*.example.com A 192.0.43.10
REF https://codex.wordpress.org/Configuring_Wildcard_Subdomains

How to configure apache to serve directory for custom domain

Currently, I have configured a domain I bought through GoDaddy to point to the elastic ip address of my personal ec2 instance. I'm having issues finding the correct solution to configure my httpd.conf such that my custom domain, example.com points to a specific subdirectory var/www/Example. Further, I want to be able to still access my other projects and sites by simply typing in the elastic ip and subdirectory.
I have tried the using a virtual host with the following configuration..
<VirtualHost *:80>
ServerAdmin webmaster#example.com
DocumentRoot "/var/www/html/Example/wordpress"
ServerName fitnessfifteen.com
ErrorLog "logs/example.com-error_log"
CustomLog "logs/example.com-access_log" common
</VirtualHost>
When I do this, I can access the correct content by going to www.example.com however, I'm unable to access my other files and projects via 11.11.111.111/OtherProjectDirectory (I get that default internal server error page). I'm completely new to this sort of stuff so many this isn't possible and I have a fundamental misunderstanding.
Add another virtual host to http.conf as below and restart apache.
<VirtualHost *:80>
ServerAdmin webmaster#example.com
DocumentRoot "/var/www/html/Example/wordpress/OtherProjectDirectory"
ServerName 11.11.111.111
ErrorLog "logs/example.com-error_log"
CustomLog "logs/example.com-access_log" common
</VirtualHost>

Wordpress not working when using Apache virtual hosts

I currently use virtual hosts on my computer so that I can manage multiple sites on my computer.
Currently, I use c:/vhosts/php (default localhost) for regular PHP development, c:/vhosts/BTS for Wordpress, and c:/vhosts/cake for CakePHP development. (see below).
Now when I launch my WAMPP and go to http://BTS, it loads the index page but nothing else loads fine. When trying to click on the links, it links to http://localhost/xxxxx instead of http://BTS/xxxxx. What am I missing here? I don't want the server to access localhost since I'm using localhost for other projects. Please help.
<VirtualHost *:80>
DocumentRoot c:/vhosts/php
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot c:/vhosts/BTS
ServerName BTS
</VirtualHost>
<VirtualHost *:80>
DocumentRoot c:/vhosts/cake
ServerName cake
</VirtualHost>
Go into your MySQL database (thru phpmyadmin or whatever) and look for the following fields
In the wp_options table, change
siteurl
home
To http://BTS instead of localhost.
This will update all your links in wordpress.
You need to tell Wordpress what domain it is sitting on.
Login to your Admin CP, it's in settings somewhere
I think is in wordpress options in settings in general, then change in WordPress Address (URL) and in Site Address (URL), both need to be the same:
This is my configure, but you can change it with BTS
And check if it's right in mysql the configure with
select option_name, option_value from wp_options where option_name = 'siteurl';

Resources