You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jonathan Mast <jh...@gmail.com> on 2009/12/15 16:48:15 UTC
[users@httpd] Enabling SSL on a virtual host
I have a single webserver (1 IP) to which many DNS entries point to. Up
till now I've haven't needed SSL and the following config pattern has worked
fine for me:
<VirtualHost *>
ServerName foo.mysite.com
...
</VirtualHost>
<VirtualHost *>
ServerName bar.mysite.com
...
</VirtualHost>
However, when I added SSL to to foo.mysite.com, the config had to become:
<VirtualHost foo.mysite.com:443>
...SSLStuff
In the meantime non-HTTPS traffic to foo.mysite.com worked fine except that
the Alias directives did not work. So I realized the problem (the port was
only for 443) and changed the config to:
<VirtualHost foo.mysite.com:80 foo.mysite.com:443>
But this has the unwanted effect of returning 400 Bad Request to HTTP
traffic for foo.mysite.com, with this message:
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.
So my question is, how do I configure the VirtualHost to allow HTTP traffic
(port 80) and HTTPS traffic (443)?
Re: [users@httpd] Enabling SSL on a virtual host
Posted by Krist van Besien <kr...@gmail.com>.
On Tue, Dec 15, 2009 at 5:37 PM, Jonathan Mast
<jh...@gmail.com> wrote:
> I'm thinking that the host name actually is required in the VirtualHost
No it is not required.
A hostname in a VirtualHost directive is internally converted to an IP
address and only needed if this VirtualHost needs to be bound to a
particular IP on a multi homed host. In most practical scenarios
having *:443 and *:80 in your VirtuaHost direcives is perfectly
adequate.
Krist
--
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Enabling SSL on a virtual host
Posted by Jonathan Mast <jh...@gmail.com>.
I'm thinking that the host name actually is required in the VirtualHost
declaration.
But the 2 separate VirtualHost entries worked, thanks
On Tue, Dec 15, 2009 at 10:53 AM, Eric Covener <co...@gmail.com> wrote:
> On Tue, Dec 15, 2009 at 10:48 AM, Jonathan Mast
> <jh...@gmail.com> wrote:
> > So my question is, how do I configure the VirtualHost to allow HTTP
> traffic
> > (port 80) and HTTPS traffic (443)?
>
> You need two virtualhosts, one with SSL and one without. If you want
> everything other than SSL to be common, use Include to source a common
> config.
>
> I'd suggest *:80 and *:443 until you have to actually discriminate
> based on the local IP address. If you need to discriminate based on
> hostname requested for non-SSL, add NameVirtualHost *:80.
>
> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: [users@httpd] Enabling SSL on a virtual host
Posted by Eric Covener <co...@gmail.com>.
On Tue, Dec 15, 2009 at 10:48 AM, Jonathan Mast
<jh...@gmail.com> wrote:
> So my question is, how do I configure the VirtualHost to allow HTTP traffic
> (port 80) and HTTPS traffic (443)?
You need two virtualhosts, one with SSL and one without. If you want
everything other than SSL to be common, use Include to source a common
config.
I'd suggest *:80 and *:443 until you have to actually discriminate
based on the local IP address. If you need to discriminate based on
hostname requested for non-SSL, add NameVirtualHost *:80.
--
Eric Covener
covener@gmail.com
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org