SSL + Apache on VirtualHost

Hi there.

I have Apache 1.x running with a number of VirtualHosts. Recently, the need has arisen for me to offer secure communications on one of my VirtualHosts (on the whole website once the user has authenticated, not just a /members/ area)

So, in my Apache config, I now have two virtualhost sections for the same website, bith identical except that one has the SSL related directives in it, and the Virtualhost directive looks like

 <virtualhost *="">ServerName mydomain.com
...</virtualhost> 

For the first one, and:

 <virtualhost *:443="">ServerName mydomain.com
...</virtualhost> 

for the second one, with all the custom error pages, etc identical in both. This seems cumbersome, but I can't find an answer anwhere as to whether I can combin the two into one single directive that can handle both port 80 and 443 traffic.

Am I doing this correctly? It seems like alot of duplication in each respective section with the loggin, custom error pages, aliases, all existing in both locations.

Thanks for any input!

2 Replies

I think what you have done is how you're meant to do it. One file tree accessed with two different behaviours, depending on the connection port, requires two virtual hosts.

@pclissold:

I think what you have done is how you're meant to do it. One file tree accessed with two different behaviours, depending on the connection port, requires two virtual hosts.

Great, thank you!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct