I have set up staging and live site on the same machine with different document root as follows:
mysite
: Staging site without sslmysite_live
: Live site with ssl enabled
Both the sites have there own databases with same name as that of the document root respectively.
Site Urls are:
staging.mysite.org
: Staging sitemysite.org
: Live site
Whenever I try to visit my live site with the url: mysite.org
, it shows me the staging site pages and in the url it shows the http://www.mysite.org/
. From the URL it looks like the it does not take the https by default. If I type it as: https://www.mysite.org/
, this works and I get live site.
If I visit staging.mysite.org
, it shows me the staging site page. this means the staging url is working fine.
I am not getting why this is happening. And on every click on any link on live site opens the staging site pages but in the url it looks like it is live site only because the url remains as http://www.mysite.org/
.
Virtualhosts configurations as as follows:
- staging site
SuexecUserGroup "#1001" "#1001"
ServerName staging.mysite.org
DocumentRoot /home/mysite/web/public/mysite
UserDir /home/mysite/homes/*/web/public
CustomLog /home/mysite/logs/access_log combined
ScriptAlias /cgi-bin/ /home/mysite/cgi-bin/
ScriptAlias /fcgi-bin/ /home/mysite/fcgi-bin/
Options -Indexes IncludesNOEXEC FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
Allow from all
Order allow,deny
Allow from all
Order allow,deny
Allow from all
SSLEngine off
- Live site
DocumentRoot "/home/mysite/web/public/mysite_live"
ServerName mysite.org
AllowOverride All
Order allow,deny
allow from all
Options +Indexes
DocumentRoot "/home/mysite/web/public/mysite_live"
ServerName mysite.org
AllowOverride All
Order allow,deny
allow from all
Options +Indexes
SSLEngine on
SSLCertificateFile /home/mysite/etc/SSL/mysite.org.crt
SSLCertificateKeyFile /home/mysite/etc/SSL/mysite.key
SSLCACertificateFile /home/mysite/etc/SSL/mysite.org.crt
I think there is some issue with the configuration part. but not getting what it is.
Answer
You don't have a ServerAlias
for www.mysite.org
in your live site config, so the webserver doesn't know how to serve content for that name, and falls back to the default site (which is presumably the staging site). It's serving correctly for HTTPS because you only have one HTTPS vhost, which is the live site.
No comments:
Post a Comment