|
Mon, 25 January 2010 10:22  |
Registered: January 2010
Messages: 2
|
I have to use SSL in two websites, each one obviously using a different domain and IP number. For testing I generated a certificate through #make-ssl-cert.
# mkdir /etc/apache2/ssl/
# make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
# a2enmod ssl
# /etc/init.d/apache2 force-reload
After I opened the file /etc/apache2/ports.conf and added "listen 443".
The virtual hosts I configured in /etc/apache2/sites-available/default.
So in the default I have:
<VirtualHost xx.xxx.xx.xx1:80> (of course the xxxx is my ip no.)
Arguments....
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
</VirtualHost>
<VirtualHost xx.xxx.xx.xx2:80>
Arguments....
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
</VirtualHost>
Using the configuration like this, both domain can access through https without issue, however, when I just try to access as http I receive this message:
Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
Hint: https://MYDOMAINHERE.com
What is wrong in my setting?
I also want to ask if is there some problem on put the Virtualhost setting inside /etc/apache2/sites-available/default, just like I did. Also, why does the two domain work with the same certificate? When I generate the final one, if I do like that will it keep working (only one certificate for two domain), or do I necessarily generate two certificates (of course I'm talking about an authenticated one).
Please someone, help me on that. Thanks.
|
|
|
|
Tue, 16 February 2010 20:09   |
Registered: May 2009
Messages: 21
|
Very simple: your browser tries to use insecure HTTP on port 80, while the server only supports HTTPS on that port. The error message is self-explaining
Here is your configuration: (there are TWO entries for TWO virtual hosts for EACH IP)
<VirtualHost xx.xxx.xx.xx1:443>
Arguments for first host....
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
</VirtualHost>
<VirtualHost xx.xxx.xx.xx2:443>
Arguments for second host....
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
</VirtualHost>
<VirtualHost xx.xxx.xx.xx1:80>
Same arguments but no SSL engine....
</VirtualHost>
<VirtualHost xx.xxx.xx.xx2:80>
Same arguments but no SSL engine....
</VirtualHost>
I hope I've been of help
|
|
|
|
Sun, 28 February 2010 03:03  |
Registered: January 2010
Messages: 2
|
Thanks! Working perfectly well now
|
|
|