Wordpress + Wordpress Network on Single Server conflict - wordpress

I have two installs of wordpress on a single Amazon EC2 server. One of them is just a regular wordpress install, the other being a wordpress network install, with WP Domain Mapping installed.
So let's say I have four domain names: site.example.com, multisite.example.com, multisite1.com and multisite2.com
All of the domain names are pointing to the same IP address. Multisite1.com and multisite2.com are domain mapped to blogs under the multisite.example.com wordpress network
On my server httpd.conf is setup as follows:
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/site1
ServerName site.example.com
ErrorLog logs/site_error_log
CustomLog logs/site_access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/multisite
ServerName multisite.example.com
ErrorLog logs/multisite_error_log
CustomLog logs/multisite_access_log combined
</VirtualHost>
Right now, all of the domains seem to go to the right place - until I start getting to the wp-admin panel.
site.example.com/wp-admin and multisite.example.com/wp-admin appear to work fine.
multisite1.com/wp-admin and multisite2.com/wp-admin both seem to redirect to site.example.com/wp-admin instead of multisite.example.com/wp-admin.
I can't figure out why. I have tried putting all of the domain names in the virtual host as ServerAlias but it doesn't seem to have helped. I've also put in a wildcard ServerAlias under multisite.example.com as well, but no luck.
Any ideas? It is a bizarre install I know, but for the time being for other reasons, I have to get it to work this way. I will eventually separate the two.

Create a new sites-available entry for each of your sub-domain or virtual host for each sub-domain pointing to the same web root and reload the apache. After that all will work fine.
For e.g.
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/multisite
ServerName multisite1.com
ErrorLog logs/multisite_error_log
CustomLog logs/multisite_access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/multisite
ServerName multisite2.com
ErrorLog logs/multisite_error_log
CustomLog logs/multisite_access_log combined
</VirtualHost>

Related

XAMPP Wordpress Site is not accessible from production server

My Needs are
1. Configure Multiple Domain on XAMPP server on production (Woocommerce Site)
2. Configure and enable ssl
Steps i followed
Edited httpd-vshost as
NameVirtualHost *:80
ServerAdmin mail#firstsite.in
DocumentRoot "C:/xampp/htdocs/firstsite"
Allow from all
ServerName firstsite.in
ServerAlias www.firstsite.in
ServerAdmin mail#secondsite.in
DocumentRoot "C:/xampp/htdocs/secondsite"
ServerName secindsite.in
ServerAlias www.secondsite.in
Allow from all
Edited httpd-ssl
<VirtualHost _default_:443>
ServerAdmin admin#localhost
DocumentRoot "C:/xampp/htdocs/firstsite"
ServerName firstsite.in:443
ServerAlias www.firstsite.in:443
ErrorLog "logs/example-error.log"
CustomLog "logs/example-access.log" common
SSLEngine on
SSLCACertificateFile "C:\xampp\apache\conf\mibstore\ca_bundle.crt"
SSLCertificateFile "C:\xampp\apache\conf\mibstore\server.crt"
SSLCertificateKeyFile "C:\xampp\apache\conf\mibstore\server.key"
</VirtualHost>
<VirtualHost _default_:443>
ServerAdmin admin#localhost
DocumentRoot "C:/xampp/htdocs/secondsite"
ServerName secondsite.in:443
ServerAlias www.secondsite.in:443
ErrorLog "logs/example-error.log"
CustomLog "logs/example-access.log" common
SSLEngine on
SSLCACertificateFile "C:\xampp\apache\conf\ricebazzar\ca_bundle.crt"
SSLCertificateFile "C:\xampp\apache\conf\ricebazzar\server.crt"
SSLCertificateKeyFile "C:\xampp\apache\conf\ricebazzar\server.key"
</VirtualHost>
I have obtained SSL certificate from sslforfree and stored them on relevant path
I also edited etc\hosts file
127.0.0.1 firstsite.in
127.0.0.1 secondsite.in
Issue
I can able to browse them from the server(windows) itself , but can't able to access them from outside. the relevant domain names are purchased and added a A record to point the IP.
Notes
Using Amazon AWS EC2 instance
Added Inbound Rules on 80 & 443, And also added firewall rules on 80 & 443
Would you tried in another PC to visit them since you changed your host file on your PC.
If they can be visited then you need remove the record of your host file.
If not, please try:
Does both the A record of WWW and Non-WWW have been pointed to IP.
If pointed, please tell me what error or message you see on browser when you load the websites.
If there're no error or message which means they are blank page, please try to check is there any htaccess file, do you enable the rewrite mod of xampp.

WAMP second virtual host not working/re-directing to first

I got VH working fine.
Localhost and my first site (which is attached to a domain) work absolutely fine, no issues.
However I wanted to add a second site (3rd if you include localhost) to experiment with a new site. However after having added it, it simply seems to re-direct to the first site's domain. They are both wordpress installations (although the 3rd isnt installed yet as I cant access it) but I'm not sure if that's relevant.
Here's my two relevant files;
httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/mysite"
ServerName mysite.local
<Directory "c:/wamp/www/mysite">
AllowOverride All
Require local
</Directory>
ErrorLog "logs/mysite-error.log"
CustomLog "logs/mysite-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin info#mydomain.co.uk
DocumentRoot "c:/wamp/www/wordpress"
ServerName mydomain.co.uk
ServerAlias www.mydomain.co.uk
<Directory "c:/wamp/www/wordpress">
AllowOverride All
</Directory>
ErrorLog "logs/wordpress-error.log"
CustomLog "logs/wordpress-access.log" common
</VirtualHost>
As explained.. localhost works, mydomain.co.uk works (name changed for privacy reasons but it works!). mysite.local does not it just redirects to mydomain.co.uk ???? (I tried a bunch of names including mysite.localhost, etc etc-- nothing works! I don't care what the name is I just want to be able to access it, will be buying a domain for it soon).
Any help is appreciated. Thank-you!
Here's hosts file although it's pretty self explanatory;
127.0.0.1 localhost
127.0.0.1 mysite.locals
127.0.0.1 mydomain.co.uk
::1 localhost
::1 mysite.local
::1 mydomain.co.uk

Configuring .htaccess for multiple wordpress sites

I have multiple wordpress installs that I need to access with multiple domains and I need a way to accomplish this. I have devised a folder structure that I think will be the best way, but I need help with the .htaccess. For simplicity sake, let's say I have two wordpress sites. Fully separate.
www.b.campscoreboard.net is in the folder
/a/b
www.c.campscoreboard.net is in the folder
/a/c
www.campscoreboard.net is pointing to
/a
The a folder contains nothing except an .htaccess file to help me route the domains properly. That's where I need help. I would like to point www.campscoreboard.net to that root /a folder. In my perfect world, the following things would work.
The "b" site would work just fine using www.b.campscoreboard.net or campscoreboard.net/b
The "c" site would work just fine using www.c.campscoreboard.net or www.campscoreboard.net/c
I need "b" and "c" to have their built in permalinks functions to still work. In other words, if I type www.c.campscoreboard.net/forums, I need that to work. I don't want to have to go all the way back to www..campscoreboard.net/c/forums for my links to work (which is what it's currently doing).
What needs to be in that .htaccess file in the /afolder to properly route these domains?
Update 1: Rather than breaking real sites trying this stuff, I just made 2 wordpress installs in the directory tree above. Sorry about the www's. That's what worked for testing purposes.
Here's what happened:
After installing the sites, they worked as expected. I could load the two wordpress sites with either b.campscoreboard.net or campscoreboard.net/b.
However, I got an internal server error on all campscoreboard.net, b.campscoreboard.net, and c.campscoreboard.net after adding the suggested .htaccess of...
<VirtualHost *:80>
ServerAdmin admin#localhost
ServerName b.campscoreboard.net
ServerAlias www.b.campscoreboard.net
DocumentRoot /a/b
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#localhost
ServerName c.campscoreboard.net
ServerAlias www.c.campscoreboard.net
DocumentRoot /a/c
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
What do you think I'm doing wrong?
Follow these steps:
a) Create Apache virtualhost:
Read this tutorial.
Example configuration:
<VirtualHost *:80>
ServerAdmin admin#localhost
ServerName mudministry.com
ServerAlias www.mudministry.com
DocumentRoot /mudmin/home
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#localhost
ServerName userspice.com
ServerAlias www.userspice.com
DocumentRoot /mudmin/userspice
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
b) Add wordpress files in /mudmin/home and /mudmin/userspice. Make sure you access these sites first time using the servernames specified above. mudministry.com and userspice.com
This will make sure the your wordpress urls are generated correctly.
c) Use Reverse proxy for mudministry.org
Read this tutorial:
Example configuration:
<VirtualHost 10.10.1.91:80>
ServerName mudministry.org
ServerAdmin webmaster#localhost
## You dont have to keep this /mudministry
DocumentRoot /var/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyAddHeaders Off
ProxyPass /home http://mudministry.com
ProxyPassReverse /home http://mudministry.com
ProxyPass /userspice http://userspice.com
ProxyPassReverse /userspice http://userspice.com
</VirtualHost>

Why does localhost work but my alias does not?

I currently have this apache2 site configuration:
<VirtualHost *:80>
ServerAdmin admin#example.com
ServerName engine.com
ServerAlias www.engine.com
DocumentRoot /var/www/engine.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
If I type engine.com I just get a blank page.
My directory setup is like this
/var/www/engine.com/public_html/wp-content...
Localhost works fine and wordpress installation is triggered, but as I say engine.com just brings me a blank page.
Don't you need to add
engine.com 127.0.0.1
to your hosts file?

www being served on iis, non-www being served on apache?

Here is the problem, if you visit the site directorybest.net you will see the correct website (which is defined in apache). But if you go to the www version of the site a catch all site for and from IIS is displayed. I have no idea what this is causing this.
I have another site that already runs fine on apache from which I copied the info for DNS and vhost settings. I also have set the DNS up so that both sites point to the same ip address. Does anyone know why the www version of the site does not show the right website?
Here is the vhost information for both the working and non working site.
NameVirtualHost *
#non-working site
<VirtualHost *>
ServerAdmin admin#email.com
ServerName www.directorybest.net
ServerAlias directorybest.net *.directorybest.net
DocumentRoot "D:\WWW\DirectoryBest\2"
DirectoryIndex index.php
<Directory D:\WWW\DirectoryBest\2>
AllowOverride All
</Directory>
# Logfiles
ErrorLog D:\WWW\DirectoryBest\2\logs\error.log
CustomLog D:\WWW\DirectoryBest\2\logs\access.log combined
</VirtualHost>
#working site
<VirtualHost *>
ServerAdmin admin#email.com
ServerName www.directorybest.info
ServerAlias directorybest.info *.directorybest.info
DocumentRoot "D:\WWW\DirectoryBest\1"
DirectoryIndex index.php
<Directory D:\WWW\DirectoryBest\1>
AllowOverride All
</Directory>
# Logfiles
ErrorLog D:\WWW\DirectoryBest\1\logs\error.log
CustomLog D:\WWW\DirectoryBest\1\logs\access.log combined
</VirtualHost>
Ok so I was just informed that the company has had DNS problems before. And upon further checking the local DNS had not been updated and was still resolving to the old ip address.

Resources