Re: [users@httpd] Apache VirtualHost Setup Question

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

 



Hi Christopher,
You need to setup virtual hosts for aaa.com, bbb.com both at 80 and 443 ports.
Try the following configuration.

<VirtualHost 10.10.100.146:80>
  ServerName          www.aaa.com
  DocumentRoot        /var/www/html/aaa
</VirtualHost>
<VirtualHost 10.10.100.146:80>
  ServerName          www.bbb.com
  DocumentRoot        /var/www/html/bbb
  RewriteEngine On
  RewriteCondition %{SERVER_PORT} !^443$
   RewriteRule ^/(.*) https://www.bbb.com/$1
</VirtualHost>

<VirtualHost 10.10.100.146:443> ServerName www.bbb.net
  DocumentRoot    /var/www/html/bbb
  Alias           /bbb /var/www/html/bbb
ErrorLog logs/ssl_error_log TransferLog logs/ssl_access_log
  SSLEngine       On
  SSLProxyEngine  On
  SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
  SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
...
</VirtualHost>

<VirtualHost 10.10.100.146:443> ServerName www.aaa.net
  DocumentRoot    /var/www/html/aaa
ErrorLog logs/ssl_error_log TransferLog logs/ssl_access_log
  SSLEngine       On
  SSLProxyEngine  On
  SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
  SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
...
  RewriteEngine On
  RewriteCondition %{SERVER_PORT} !^80$
   RewriteRule ^/(.*) http://www.aaa.com/$1
</VirtualHost>


I hope this will resolve the issue of conversion from http to https.
I have a similar kind of setup running correctly.
let me know the result with this setup.

I didnt understand why have you given that alias.
Can u explain in brief, what you were trying to achieve


Thanks,
Omprakash.
omprakash@xxxxxxxxxxxx
+91 9866 666460


Christopher Paluch wrote:
I am trying to setup an Apache server that will service two domains: www.aaa.com and www.bbb.net. I want users to only access www.aaa.com using http://www.aaa.com and I only want users to access www.bbb.net using https://www.bbb.net.

I've tried the following config:

<VirtualHost 10.10.100.146:80>
   ServerName          www.aaa.com
   DocumentRoot        /var/www/html/aaa
</VirtualHost>
<VirtualHost 10.10.100.146:443>          ServerName      www.bbb.net
   DocumentRoot    /var/www/html/bbb
   Alias           /bbb /var/www/html/bbb
ErrorLog logs/ssl_error_log TransferLog logs/ssl_access_log
   SSLEngine       On
   SSLProxyEngine  On
   SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
   SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
...
</VirtualHost>

Typing in http://www.aaa.com works fine as does https://www.bbb.net/bbb. If I type in https://www.aaa.com I receive an error page saying "/" is not accessible. The URL https://www.bbb.net causes the same error page. So it seems that the DocumentRoot for port 443 is being ignored. Anyone have an idea why it is? Also I would like to set things up so someone typing in https://www.aaa.com get re-directed to http://www.aaa.com. Similar for http://www.bbb.net gets re-directed to https://www.bbb.net. So far I can't figure out how to accomplish that.
Thanks for any help.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[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