[SOLVED] Apache with and without SSL == Site with https and http
Hi
I have a small problem.
My Apache is configured in this way that I have one IP and more VirtualHost
Something like this:
Code:
NameVirtualHost 123.456.7.89
..
<VirtualHost subdomain.site.com >
....
</VirtualHost>
<VirtualHost subdomain2.site.com>
</VirtualHost>
<VirtualHost subdomain.othersite.com>
...
</VirtualHost>
Now I need to have one site with SSL Encryption.
So I tried something like this
Code:
NameVirtualHost 123.456.7.89
..
<VirtualHost subdomain.site.com >
ServerName subdomain.site.com
</VirtualHost>
<VirtualHost subdomain.othersite.com>
...
</VirtualHost>
<VirtualHost subdomain.site.com >
ServerName subdomain.site.com:443
SSLCertificateFile /etc/httpd/ssl/cert.crt
SSLCertificateKeyFile /etc/httpd/ssl/cert.key
SSLEngine on
......
</VirtualHost>
In this way the subdomain.site.com was accessible via https and all sites returning 400 - bad request when I tried to access it via http.
I read a bit and found out that the SSL encrypted site have to have own IP address. So I ordered new IP and tried this:
DNS-Entry shows subdomain.site.com on IP 123.456.7.900
Code:
NameVirtualHost 123.456.7.89
..
<VirtualHost subdomain.site.com >
ServerName subdomain.site.com
</VirtualHost>
<VirtualHost subdomain.othersite.com>
...
</VirtualHost>
<VirtualHost 123.456.7.900 >
ServerName subdomain.site.com:443
SSLCertificateFile /etc/httpd/ssl/cert.crt
SSLCertificateKeyFile /etc/httpd/ssl/cert.key
SSLEngine on
......
</VirtualHost>
Now are all other site ok again (accessible via HTTP).
But the site I need to secure subdomain.site.com is accessible via https.
If I try to access it with http I get 400 - bad request.
What I need to do is to have:
- Several named based VirtualHost without encryption
- One or more sites with SSL encryption
- One or more sites accessible with and without SSL encryption
- I have 5 IP addresses available for it.
It is possible?
Kind regards,
Neo