I would like my apache2 instance to serve HTTPS (a simple page or really just anything) on default port 443 just be available, e.g. for letsencrypt certificate installation client and to serve multiple services (wikis, issue trackers, etc.) on other ports (e.g. dokuwiki on port 446).

Serving those non-default ports worked fine for multiple services before enabling HTTPS on port 443 (see below) with site configurations like

Listen 0.0.0.0:446 https

Alias /dokuwiki/ "/var/www/html/dokuwiki/"

DirectoryIndex index.php index.html index.htm

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php .htm .html

<Directory "/var/www/html/dokuwiki">
    Options None
    AllowOverride Limit

    Require all granted
</Directory>

<VirtualHost [hostname]:446 >
    ErrorLog /var/log/dokuwiki/dokuwiki.log
    SSLEngine On
    DocumentRoot "/var/www/html/dokuwiki"
    ServerName [hostname]
    SSLCertificateFile /etc/letsencrypt/live/[hostname]/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/[hostname]/privkey.pem
</VirtualHost>

After enabling Listen 443 in /etc/apache2/ports.conf, turning SSLEngine on in /etc/apache2/sites-enabled/default-ssl.conf and specifying the SSL certificate and key in SSLCertificateFile and SSLCertificateKeyFile, dokuwiki is served with HTTPS on port 443 and 446 no longer serves HTTPS, but apache2 uses the port according to netstat -tupln.

/etc/apache2/sites-available/default-ssl.conf is

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin admin@[hostname]

                DocumentRoot /var/www/html

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

                SSLEngine on

                SSLCertificateFile /etc/letsencrypt/live/[hostname]/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/[hostname]/privkey.pem

                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>

        </VirtualHost>
</IfModule>

I guess dokuwiki is served on port 443 because it matches with the directory structure. I have to figure out how to turn that off, but that's a separate problem. I don't get why 446 is no longer served (firefox 47.0 displays SSL_ERROR_RX_RECORD_TOO_LONG and says that the site simply doesn't serve HTTPS and the dokuwiki site log contains [Thu Jul 21 14:42:48.803900 2016] [ssl:info] [pid 13028] AH01914: Configuring server richtercloud.de:443 for SSL protocol which doesn't make any sense). Is this a bug?

I found https://serverfault.com/questions/528210/bind-apache-ssl-port-with-different-port-with-same-openssl-port-443, but the solution there is my problem.

I'm using Ubuntu 16.04.

closed as off-topic by MadMike, Fabby, George Udosen, Eric Carvalho, guntbert Jun 16 at 16:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This describes a problem that can't be reproduced, that seemingly went away on its own or was only relevant to a very specific period of time. It's off-topic as it's unlikely to help future readers." – MadMike, Fabby, George Udosen, Eric Carvalho, guntbert
If this question can be reworded to fit the rules in the help center, please edit the question.

Everything works fine now with the described settings. The behaviour might be because of firefox cache loading nonsense.

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