Report this

What is the reason for this report?

How do I use SSL on multiple ports?

Posted on July 18, 2016

Hello, I followed the docs on how to install an SSL but I have multiple ports that run on my droplet. I’d actually like to not be limited by which port SSL runs on. Is this possible?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Is it possible to configure “https” in same domain for multiple ports? Like https://example.com:446 https://example.com:447

First you need to tell apache to listen on multiple ports. You can do that by editing the /etc/apache2/ports.conf

Listen 80
<IfModule ssl_module>
        Listen 443
        Listen 444
        Listen 446
</IfModule>

And your virtualhost file should look like this with the port number.

<VirtualHost *:446>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html


        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        SSLEngine on
        SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
        SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
</VirtualHost>

Thanks for the answer, but I forgot to mention I was using nginx instead of Apache. How would this change, since I assume I’d be editing the /etc/nginx/sites-available/default file, right?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.