bind apache ssl port with different port with same openssl port 443
Yes, it is possible to bind Apache to different port and still use SSL.
Replace the Listen
directives in your apache config. The config should contain line like
Listen 80
Listen 443
Apache will listen on the ports defined with these configuration options. Replace them, and Apache will listen on a different port.
However, you still need to tell Apache what to serve on the ports above. Suppose you want Apache to start listening on port 8080 (plain), and 4433 (ssl). Then you need to replace the Listen directives to
Listen 8080
Listen 4433
After this, define two VirtualHosts on these ports like this:
NameVirtualHost 0.0.0.0:8080
NameVirtualHost 0.0.0.0:4433
<VirtualHost 0.0.0.0:8080>
ServerName the.server.name
ServerAlias *
DocumentRoot /var/www/plain
</VirtualHost>
<VirtualHost 0.0.0.0:4433>
ServerName the.server.name
ServerAlias *
DocumentRoot /var/www/ssl
SSLEngine On
SSLCertificateFile /the/certificate/file
SSLCertificateKeyFile /the/key/file
</VirtualHost>
If you don't have any more VirtualHost definition, you don't have to include the ServerAlias
directive (or the ServerName
, for that matter).
If you restart Apache, it will listen on 8080 for unencrypted connections, and on port 4433 for SSL. Be sure not to have any old VirtualHost definition which contain the wrong port number.