SOLVED: Docker error behind NGINX
Asked by dwfa:

I have configured confluence docker image to run behind NGINX using postgreSQL and I get this error

**Tomcat config is incorrect**

The Tomcat server.xml has an incorrect configuration:

**scheme** should be 'http'  
**proxyName** should be 'wiki.dwfa.ca'  
**proxyPort** should be '80'

[Troubleshoot](https://confluence.atlassian.com/x/IfcCO)

I have set the environment variables in the script that starts docker according to the documentation for confluence docker image.

ATL_PROXY_NAME=wiki.dwfa.ca  
ATL_PROXY_PORT=80  
ATL_TOMCAT_PORT=8090

Why is this occurring?


Answers:
author: Kurt Klinner
body: [@dwfa](/t5/user/viewprofilepage/user-id/808796)

Could you share your complete tomcat config as well as the nginx config?

Cheers

Kurt

comments: author: dwfa
body: I did not alter the tomcat server.xml since it is inside the docker image. As for NGINX:

```
worker_processes 1;

events {?worker_connections 1024;?}

http
{
  include mime.types;
  default_type application/octet-stream;
  sendfile on;
  keepalive_timeout 65;

  server
  {
    listen 80;
    server_name localhost;

    location /
    {
      root /usr/share/nginx/html;
      index index.html index.htm;
    }
    error_page 500 502 503 504 /50x.html;
    location = /50x.html
    {
      root /usr/share/nginx/html;
    }
  }

  server
  {
    listen 80;
    server_name wiki.dwfa.ca;
    location /
    {
      proxy_pass http://localhost:8090/;
    }
  }
}
```


author: Kurt Klinner
body: [@dwfa](/t5/user/viewprofilepage/user-id/808796)

the nginx config looks good,

based on the docker documentation the shared variables should also be fine.

Are you using docker-compose to start the container or how does your docker call look like?


author: dwfa
body: ```
docker run -v /usr/local/data/confluence/v7.3:/var/atlassian/application-data/confluence?--name=confluence -d -p 8090:8090 -p 8091:8091 atlassian/confluence-server
```


author: Nic Brough -Adaptavist-
body: Have you configured your docker image to make the needed changes to server.xml?


author: dwfa
body: I am going to say no since the Atlassian documentation did not mention that. I am going to a assume I will have to do the following

* copy that server.xml from the container to host
* update the server.xml file
* copy the server.xml file back to the container from the host
* assume using docker cp command

OR

* generate a new docker image

Either way a learning experience for me :-) Do I have that right?


author: Nic Brough -Adaptavist-
body: Not sure why you need to do all of that when all that's needed is to edit the server.xml, but yes, if you want to do it that way, it will work.


author: dwfa
body: I looked for an editor when I issued

```
docker exec -it <containerID> /bin/sh?
```

but could not find vim, vi, nor nano - and I do not think emacs is loaded into the image :-). Other suggestions would be appreciated.


author: dwfa
body: So I updated server.xml file (/opt/atlassian/confluence/conf) inside the container with the appropriate settings and restarted the container. I got the same error message, so I looked at the server.xml file and my changes were gone. It seems the files was revereted or it was regenerated (looked at the DTS of the file and it was the time the container started up) ...

Ugh ...


author: dwfa
body: I got it working - thx for the support. I needed to change the /opt/atlassian/etc/server.xml.j2 file

it look like this

```
proxyName="{{ atl_proxy_name | default(catalina_connector_proxyname) | default('') }}"
proxyPort="{{ atl_proxy_port | default(catalina_connector_proxyport) | default('') }}"
```

and I changed it to look like this

```
proxyName="{{ atl_proxy_name | default(catalina_connector_proxyname) | default('wiki.dwfa.ca') }}"
proxyPort="{{ atl_proxy_port | default(catalina_connector_proxyport) | default('80') }}"
```

That kinda tells there there is a bug in how the boot up process works. Guess I have to go over and report a defect :-). Unless I am not understanding something ...

dwfa


author: dwfa
body: I am going to close this as answered - there is enough info in this to help someone else I hope :-).

On the other hand, I have no way of opening a defect to indicate the docker image does not utilize the environment variables.

Thanks for all your help ...


author: Zeljko Milovanovic
body: This also applies to our case, even though we used Traefik as a Proxy.


author: Nic Brough -Adaptavist-
body: You'll need to amend the server.xml file to include the scheme, proxyName and proxyPort in the connector settings.

comments: author: dwfa
body: So that means I have to build my docker image based upon the one from hub.docker.com? Do I understand that correctly?


author: Nic Brough -Adaptavist-
body: I don't know, I've not looked at that image.

All I know is that if you want to run it behind a proxy, those three things need to be added into the connector settings in server.xml