[Last Call] Learn how to a build a cloud-first strategyRegister Now


How to define second ssl port on Apache

Posted on 2006-05-15
Medium Priority
Last Modified: 2012-06-27
I am trying to setup two or more ssl certificates for a machine.
I have just one IP
I have two name based Virtual hosts.
I have two separate SSL certificates.

I tried to assign each Virtual host a different port for SSL 443 and 444
I used:
Listen 80
Listen 443
Listen 444


### site1
<VirtualHost *:80>
  ServerName www.domain1.com
  DocumentRoot /www/htdocs/

# ssl site:
    ServerName  www.domain1.com
    DocumentRoot /www/htdocs/testcom/

    SSLCertificateFile  /path/to/ceritficate1.crt
    SSLCertificateKeyFile  /path/to/ceritficate1.key
    SSLCACertificateFile  /path/to/intermediate1.crt

#### site 2
<VirtualHost *:80>
  ServerName www.domain2.com
  DocumentRoot /www/htdocs/

# ssl site:
    ServerName  www.domain2.com
    DocumentRoot /www/htdocs/testcom/

    SSLCertificateFile  /path/to/ceritficate2.crt
    SSLCertificateKeyFile  /path/to/ceritficate2.key
    SSLCACertificateFile  /path/to/intermediate2.crt


But with above configuration, it is still sees the port 443 when I try to use https://www.domain2.com

I do not define port number if my URL link, and I want to avoid it.

Is there any way to do this?


Question by:Nav444
  • 2
LVL 11

Accepted Solution

kblack05 earned 140 total points
ID: 16686031
Firstly make sure you NameVirtualHost x.x.x.x
directive is not remarked out in httpd.conf

If you set up a virtual host and want it to listen on a non-default port (80 is the default port for non-secure Web communications; 443 is the default port for secure Web communications), you will need to set up a virtual host for that port and add a Listen directive to httpd.conf, corresponding to that port.

To have a virtual host work specifically for that port, add the port number to the first line of the virtual host configuration. The first line should look something like the following:

<VirtualHost ip_address_of_your_server:12331>

This line would create a virtual host that listens on port 12331. Substitute the port number you want to use for 12331 in the previous example.

Underneath the Listen lines in httpd.conf, add a line like the following, which will instruct your Web server to listen on port 12331:

Listen 12331
LVL 43

Expert Comment

ID: 16687986
You are doing good, but using in web browser https://anything.tld/ tells it to go to 443 port (it's browser issue - default)
Use: https://yourdomain.tld:444/
LVL 11

Expert Comment

ID: 16691945
If you want two SSL servers, you'll need to do what I do and
dev, tst, and devel- create totally different install trees for each
Apache instance.  See:


The idea is to have multiple builds of Apache on the same system,
and call them within their own chroots.

If you want to conceal the http://host:port address from the overhead
browser bins then you might be able to serve the page through a proxy or
with some server side programming that snatches that https://host:port/page.shtml
and serves it up under the default server with an alternate URL.


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
Fine Tune your automatic Updates for Ubuntu / Debian
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question