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?
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):
Then edit your /etc/apache2/sites-enabled/somefile so it has something like this:
You may be able to use a mod_rewrite to conceal the port if that's an issue.
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 https://www.example.com:444/ is correct, https://www.example.com:445/ 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 *.example.com 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 https://anysubdomain.example.com/.