You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Stephen Love <st...@juno.com> on 2011/04/27 02:19:33 UTC

Re: [users@httpd] One Apache ( having two hostname but one IP ) for tw o websites

I have MULTIPLES all listening on port 80. They ALL work via apache... I just INCLUDE their specific configuration differences, and it finds the right one, by name. I've been doing this for years. I can give you an example if you like.  See us online at http://www.LOVEnCompany.com.

---------- Original Message ----------
From: Tushar Chavan <tu...@hotmail.com>
To: <us...@httpd.apache.org>
Subject: [users@httpd] One Apache ( having two hostname but one IP ) for two websites
Date: Tue, 26 Apr 2011 14:00:34 +0530

Hi Experts,
 
We are using one Apache server ( two hostnames but one IP )  for two websites ( http://example_1.com/irj & https://example_2.com/irj )
Apache Hostnames :- Apache_host_1 & Apache_host_2 with same IP.
 
Web Sites 1 :- http://example_1.com/irj 
Web Sites 2 :- https://example_2.com/irj
 
We are using one apche server listening on two ports 80 & 443.
 
Now 
 1.  when I type http://Apache_host_1/irj  , it properly re-direct to http://example_1.com/irj
 2.  When I type https://Apache_host_2/irj , it properly re-direct  to https://example_2.com/irj
 3.  Now problem is but when I type http://Apache_host_2/irj , re-directs to http://example_1.com/irj . We need to re-direct this      to https://example_2.com/irj 
     ( This is because users may bot type https. Can you please give me a hint to fix this )
 
It is because , both Apache_host_1 & Apache_host_2 have same IP address.So http://Apache_host_2/irj qualifies for <VirtualHost  Apache_host_1:80>
 
Below is my configuration in httpd.conf
Listen Apache_host_1:80
NameVirtualHost directive
NameVirtualHost  Apache_host_1:80
<VirtualHost Apache_host_1:80>
ProxyPass          /irj    http://example_1.com/irj
ProxyPassreverse   /irj    http://example_1.com/irj
ServerName  Apache_host_1:80
</VirtualHost>
 
Configuration in httpd-ssl.conf
 
Listen Apache_host_2:443
NameVirtualHost directive
NameVirtualHost  Apache_host_2:443
<VirtualHost Apache_host_2:443>
ProxyPass              /irj    https://example_2.com/irj
ProxyPassreverse   /irj    https://example_2.com/irj
RequestHeader set ClientProtocol https
Redirect permanent  /irj   https://Apache_host_2/irj
ServerName  Apache_host_2:443
</VirtualHost>
 
 
Best Regards,
Tushar.
 
____________________________________________________________
Groupon&#8482 Official Site
1 ridiculously huge coupon a day. Get 50-90% off your city&#39;s best!
http://thirdpartyoffers.juno.com/TGL3131/4db76152763abf515bst04vuc