One Apache ( having two hostname but one IP ) for two websites

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
 

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux