Cannot run Confluence over https
Asked by Abdulrahman Alghamdi:

I'm going to explain what I did.

I successfully installed Jira and confluence on the same server.

I have successfully connected through https on Jira.

I'm trying to use the same certificate to make Confluence run through https too.

I know you will say port number will be a conflict. but I have tried with different port number and it crashed, then I re install it with restoring my backup then I stopped Jira and followed the same KB for conf to run it through https. at the end, I could use it over 8090 but not 8443 for some reason and that's why I need the community help.

Jira still stopped at this moment and when I try below links, http is ok but https is not.

1- http://localhost:8090 \| OK

2- https://localhost:8443 \| NO

```
<Server port="8000" shutdown="SHUTDOWN" debug="0">
<Service name="Tomcat-Standalone">
<!--
==============================================================================================================
DEFAULT - Direct connector with no proxy, for unproxied HTTP access to Confluence.

If using a http/https proxy, comment out this connector.
==============================================================================================================
-->
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol"/>
<!--
==============================================================================================================
HTTP - Proxying Confluence via Apache or Nginx over HTTP

If you're proxying traffic to Confluence over HTTP, uncomment the connector below and comment out the others.
Make sure you provide the right information for proxyName and proxyPort.

For more information see:
Apache - https://confluence.atlassian.com/x/4xQLM
nginx - https://confluence.atlassian.com/x/TgSvEg

==============================================================================================================
-->

<!--
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol"
scheme="http" proxyName="<subdomain>.<domain>.com" proxyPort="80"/>
-->

<!--
==============================================================================================================
HTTPS - Direct connector with no proxy, for unproxied HTTPS access to Confluence.

For more info see https://confluence.atlassian.com/x/s3UC
==============================================================================================================
-->


<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="48" minSpareThreads="25"
protocol="org.apache.coyote.http11.Http11Nio2Protocol"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLSv1.2" sslEnabledProtocols="TLSv1.2" SSLEnabled="true"
URIEncoding="UTF-8" keystorePass="REMOVEDFORCOMMUNITY" keystoreFile="C:\Users\Administrator\.keystore"/>

<!--
==============================================================================================================
HTTPS - Proxying Confluence via Apache or Nginx over HTTPS

If you're proxying traffic to Confluence over HTTPS, uncomment the connector below and comment out the others.
Make sure you provide the right information for proxyName and proxyPort.

For more information see:
Apache - https://confluence.atlassian.com/x/PTT3MQ
nginx - https://confluence.atlassian.com/x/cNIvMw
==============================================================================================================
-->

<!--
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol"
scheme="https" secure="true" proxyName="<subdomain>.<domain>.com" proxyPort="443"/>
-->

<Engine name="Standalone" defaultHost="localhost" debug="0">
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false" startStopThreads="4">
<Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
<!-- Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties -->
<Manager pathname=""/>
<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/>
</Context>

<Context path="${confluence.context.path}/synchrony-proxy" docBase="../synchrony-proxy" debug="0"
reloadable="false" useHttpOnly="true">
<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/>
</Context>
</Host>
</Engine>
</Service>
</Server>
```

Thanks.


Answers:
author: Daniel Eads
body: Hi Abdulrahman,

Yes, you are most certainly looking at a port conflict. Two applications can't listen on the same port. Although it may appear that Jira is not running, that doesn't necessarily mean port 8443 is currently available for Confluence to use (as is configured in the server.xml you posted). [There are a few ways of checking which ports are in use on Windows](https://stackoverflow.com/questions/48198/how-can-you-find-out-which-process-is-listening-on-a-port-on-windows). It's possible another application (or a zombie process) has the port open already.

More generally, since you're working on having both Jira and Confluence run on the same Windows server and are trying to serve them over HTTPS, I would suggest using a reverse proxy to terminate the HTTPS connection rather than doing it at Jira and Confluence themselves.

There are a few options for reverse proxies:

* nginx - typically what we prefer. It does run on Windows now. [Instructions here](https://confluence.atlassian.com/doc/running-confluence-behind-nginx-with-ssl-858772080.html)
* Apache - also well supported by Atlassian applications. [Instructions here](https://confluence.atlassian.com/x/PTT3MQ)
* IIS - it's part of Windows, and has a GUI. Slightly more finnicky in some situations but it will work fine if you're averse to nginx or Apache. [Instructions here](https://confluence.atlassian.com/kb/proxying-atlassian-server-applications-with-microsoft-internet-information-services-iis-833931378.html)

At any rate, terminating HTTPS at a reverse proxy means you're only dealing with certificate configuration at one spot instead of two. Jira would listen on its typical port of 8080, Confluence on 8090, and your reverse proxy would listen on 443 and route the requests to Jira/Confluence on their standard ports. This also means you'll have a clean URL (example: <https://jira.domain.com>) instead of a URL with a port number at the end (example: <https://jira.domain.com:8443>).

Happy to help if you have questions about the reverse proxy route!

Cheers,  
Daniel


Tags: confluence-server

server