https website got forward to another instance

I have a development webserver with ten virtual hosts and drupal system.

when I put https:// before each namespace, all of them got forwarded to one specific instance instead of its own http:// version. Here is my httpd.conf setup file.
httpd.conf.txt
Jason YuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

giltjrCommented:
The httpd.conf file you posted has nothing in it dealing with SSL, so you need to check the conf, files  in the directory /etc/httpd/conf.d  directory.
0
Jason YuAuthor Commented:
After I updated this file and add a new virtual host section, the drupal backend for the original section doesn't work now, it gave "access dened" error.
0
giltjrCommented:
Back out the changes you made then.  Drupal create .htaccess files and does some rewrites.

So in addition to looking at/for configuration files in /etc/httpd/conf.d , you need to look at the .htaccess files in the documentroot for each of your virtual hosts.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Jason YuAuthor Commented:
I am not sure which line is controlling the backend drupal login. Could you please take a look at the .htaccess file?

thanks.
.htaccess.txt
0
Jason YuAuthor Commented:
is this line the one?

# Set "protossl" to "s" if we were accessed via https://.  This is used later
  # if you enable "www." stripping or enforcement, in order to ensure that
  # you don't bounce between http and https.
  RewriteRule ^ - [E=protossl]
  RewriteCond %{HTTPS} on
  RewriteRule ^ - [E=protossl:s]


so I need add:

RewriteRule protoss="s"
0
giltjrCommented:
No, that rewrite code sets an environmental variable "protossl" to "s" if the request was https.  

What you want to look for is a virtual host definition that is set to listen on port 443 and what rewrite rules it may have associated with it.

Now one rewrite rule I did find is:

  RewriteCond %{HTTP_HOST} ^lacare.org$ [NC]
  RewriteRule ^(.*)$ http://www.lacare.org/$1 [R=301,L]

What this does is if the host name does not start withe lacare.org you will be redirected to www.lacare.org.

So of somebody enters something like http://devw.lacare.org, since the host name does not start with lacare.org, they would be re-directed to www.lacare.org.    This assumes that the .htaccess file you posted is under the directory /var/www/lac2014/html.
0
Jason YuAuthor Commented:
Thank you, giltjr, I appreciate your time to explain this to me.

Firstly, I have to let you know I am very new to Drupal system. Only get to know it since I joined this company.

Secondly, I got more confused about the http://XXX.lacare.org and https://XXX.lacare.org. Based on my former knowledge and experience. The https link should be forwarded to http link after user's logon, is this concept correct.  The reason I am asking this question is, when I put different prefix (http:// and https://) before my namespace, (like stagew.lacare.org), it hows total different websites. I am attaching a print screen for your verification.

Since these are internal webservers, you may not open the links from internet.

Please correct me if I am wrong.

Thanks.
http-and-https.png
0
Jason YuAuthor Commented:
I have 8 virtual hosts on this development webserver. It uses apache and drupal combinations.

The first 4 instances are the original instances. The second 4 instances were clones of the first 4. Right now, the issue is for instance 2 to instance 8, if I input the links with https://, all 7 instances will link to the database for the first instance.
0
giltjrCommented:
You MUST find the configuration file that has the virtual host definitions that are listening on port 443.
Technically when doing virtual hosting the http and https sites are two unique sites.  What makes them the same is if both VirtualHosts definitions are setup exactly the same, except of course the listening port (443) and all the definitions required for SSL.

--> "Based on my former knowledge and experience. The https link should be forwarded to http link after user's logon, is this concept correct. "

No, by default if you go to https you are always https.  Now some website MAY be configured/scripted in a way that the login is done using https and then switched to http, but that is not the norm.

And this has nothing really to do with Druple.  It has to do with how Web servers work period.
0
Jason YuAuthor Commented:
Here are the replies from my developer, do you think this is a SSL certificate issue. If so, I have to suggest to buy certificates for each https site.



"The issue actually seems to be that whenever you use https it always redirects to the main lac2014 directory, regardless of which domain it is

For example I placed info.php in each directory

<?php
echo $_SERVER['HTTP_HOST'] . " - Document root = " . $_SERVER["DOCUMENT_ROOT"];
?>


http://stagew.lacare.org/info.php shows document root as  /var/www/staging/lac2014/html

BUT

https://stagew.lacare.org/info.php shows document root as /var/www/lac2014/html

https://devcal.lacare.org/info.php shows document root as /var/www/lac2014/html

https://stagecal.lacare.org/info.php shows document root as /var/www/lac2014/html

https://devcov.lacare.org/info.php shows document root as /var/www/lac2014/html

https://stagecov.lacare.org/info.php shows document root as /var/www/lac2014/html

etc.

I think this is an SSL issue, since there’s no certificate on the other domains, it redirects to the domain with the SSL cert."
0
giltjrCommented:
I am going to say this one more time.

Someplace in all of your http configuration files there is a virtual host definition that is setup to listen on port 443.  You MUST, read this MUST, find that definition.

Your output above implies that you have a SINGLE virtualhost listening on port 443 and not 8 virtual hosts.  It has NOTHING to do with the SSL certificate itself.  It has EVERYTHING to do with the VirtualHost definition for the virtualhost listing on port 443.
0
Jason YuAuthor Commented:
Got it, finally, I found this file under /etc/httpd/conf.d/ssl.conf.

from line 76 to the end of the file, it defined that SINGLE  virtualhost listening on port 443. My question is if I add more Virtualhost sections for port 443 in this file, do I need repeat everyline in this section?

thanks.
ssl.conf.txt
0
giltjrCommented:
Well, I can't give you a blanket no.  

What I can say is that you need a VirtualHost definition that listens on port 443 for eachVirtualHost  you have listening on port 80.

Do you have a unique SSL Certificate for each virtual host name you have?  If so, you will need to make sure that each virtual host section points to the correct certificate.  If you don't, then all the sites except for the one the certificate is for will get an error.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jason YuAuthor Commented:
Got it, a very satisfied answer. I will go buy certificate first then clone the sections for ssl port.
0
Jason YuAuthor Commented:
Very detail answer, thank you for your help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.