Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using ubuntu 9.10, apache2 and php5. Is it a good idea to host multiple SSL sites on one IP address but on different ports? If yes, what ports should I be using?

share|improve this question
up vote 2 down vote accepted

Use whatever port you like but know that this can cause some confusion for users. If you want to do this adjust your /etc/apache2/ports.conf file and add something like this (ports are part of the cert):

<IfModule mod_ssl.c>
    # SSL name based virtual hosts are not yet supported, therefore no
    # NameVirtualHost statement here
    NameVirtualHost *:443
    Listen 443
    NameVirtualHost *:442
    Listen 442

Then edit your /etc/apache2/sites-enabled/somefile so it has something like this:

<VirtualHost *:443>
   more stuff here

<VirtualHost *:442>
   more stuff here

You may be able to use a mod_rewrite to conceal the port if that's an issue.

share|improve this answer
@johnlai2004 - if you need to use multiple IP addresses and you want to avoid using multiple ports (ie 443, 442, etc) consider installing esxi server and running multiple os builds. That way you don't have to have two or more physical servers. That being said, I've been burnt by virtual solutions before (I'm currently using them in some cases). But this would be a good case for that environment. That's how companies like Slicehost pull this off (they use Xenserver). You'd definitely be able to avoid ssl errors in IE on XP with that. – Patrick R Feb 5 '10 at 12:31

I'd say it's not a good idea as there are a number of firewalls set up as port filter that intentionally let 80 (http) and 443 (https) pass and block others. Or they police what protocols are talked on other open ports. So you'll loose parts of your audience this way.

Another source for annoyance is that your users must remember to enter the correct port number if they don't want to get a certificate error. That is: If is correct, will trigger an error, if port 445 uses the certificate for another site.

I've never tried this, but I believe that the port number even has to be part of your certificate.

Depending on your usecase you might be better off with a wildcard certificate that certifies * and you can operate any number of subdomains with that certificate. If you're scaling out you can use this on as many hosts as you like, as long as they are reached as

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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