Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a wildcard ssl certificate for *.phppointofsale.com which works fine, but when the user goes to https://www.phppointofsale.com it uses the document root of *.phppointofsale.com.

I have 2 questions

  1. Can I use this on www.phppointofsale.com, forums.phppointofsale.com, phppointofsale.com..
  2. How can I have multiple doc roots for ssl certificates?
share|improve this question

closed as off-topic by Jenny D, TheCleaner, Bryan, mdpc, Ladadadada Jun 28 '13 at 16:35

  • This question does not appear to be about professional server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

4  
This question appears to be off-topic because it concerns the use of shared web hosting by end users or resellers, rather than the administration of web hosting. –  Jenny D Jun 28 '13 at 9:30
add comment

3 Answers 3

up vote 1 down vote accepted

Cpanel places limitations on how this can be set up that don't normally exist in an apache environment (the price you pay for convenience, I guess).

There are a few ways to get around this currently:

a) You can manually edit the configuration files (This is discouraged - manual changes can be overwritten by CPanel itself)

b) Set up each subdomain as a separate account, and give each (sub)domain its own IP address (wastes IPs, tedious)

c) Use mod_rewrite to redirect your requests to the correct document root.

RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^forums\.phppointofsale\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/forums/
RewriteRule ^(.*) /forums/$1

This goes in /home/you/public_html/.htaccess and assumes that /home/you/public_html/forums is the document root for forums.phppointofsale.com.

share|improve this answer
    
I realize this is over a year old but thank-you for this solution (c). It saved my bacon. Cheers. –  jeerose Aug 2 '12 at 0:20
add comment

I noticed all of those hostnames point to the same IP address. Name based virtual hosts do not work over HTTPS because the HOSTNAME is sent in the http headers which are encrypted. The only way around it is to have each ssl vhost on a different IP address or port.

That limitation is described at wiki.apache.org

share|improve this answer
    
I do use *.phppointofsale.com, which seems to work for those domains. Is this considered 1 vhost and the others considered another vhost? –  Chris Muench Apr 8 '11 at 17:28
    
You can have multiple SSL vhosts on a single IP. Both wildcard and Multi-Domain SSL certificates make this possible without having to use SNI. –  calman Apr 8 '11 at 17:49
    
@calman how would I do this with cpanel? –  Chris Muench Apr 8 '11 at 18:26
add comment

However, if you control the server, you can setup SNI.

... extension to the SSL protocol called Server Name Indication ... With SNI, you can have many virtual hosts sharing the same IP address and port, and each one can have its own unique certificate (and the rest of the configuration).

http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI

http://en.wikipedia.org/wiki/Server_Name_Indication

share|improve this answer
    
This doesn't apply here. The OP has a single wildcard certificate, not multiple unique certificates, and CPanel uses its own custom build of apache which doesn't yet support SNI. –  calman Apr 10 '11 at 23:31
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.