Why does localhost work but my alias does not? - wordpress

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?

Related

Apache2 shows default page even after disabling it

I've moved a wordpress site to an Ubuntu Server. While I access it from localhost everything works fine but when I try from my public IP address I can only see the apache2 default page.
I tried everything:
Disabled 000-default.conf and enabled mine
Deleted the default HTML page
Added AllowOverride All
Here there's my Virtual Host file
<VirtualHost *:80>
<Directory "/var/www/exidis">
AllowOverride All
</Directory>
ServerName alternanza.duckdns.org
ServerAlias www.alternanza.duckdns.org
DocumentRoot /var/www/exidis
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Thanks in advance for any suggestion

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.

Possible to run React JS and Wordpress on the same web server?

I am using the Wordpress REST API to provide a back end to my React JS front end. Right now both are running on separate Apache servers on AWS and all works well.
Is it possible to run both on the same server? So that my React front end is making requests to Wordpress on the same server?
Sure, if you want to use Apache to handle distributing your frontend and handling the WP backend, read up on Virtual Hosts: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
The gist of it is that you'll have a VH for your frontend
<VirtualHost *:80>
ServerAdmin admin#example.com
ServerName example.com
ServerAlias www.example.com <-- see here
DocumentRoot /var/www/example.com/client
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
and a VH for your backend
<VirtualHost *:80>
ServerAdmin admin#example.com
ServerName example.com
ServerAlias api.example.com <-- and here
DocumentRoot /var/www/example.com/server
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

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>

Wordpress + Wordpress Network on Single Server conflict

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>

Resources