Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Nginx Configuration for Confluence Docker Image

Hi Team,

 

We have deployed the docker confluence server in the host and we are able to access the application on http://ip:port

Now we want to enable TLS encryption using Nginx.

May we know the Nginx Config to implement same.

 

 

--

Thanks,

Anil Kumar

1 answer

1 vote

Hello Anil,

Here is how I set up Nginx in front of Confluence docker container:

  1. Pull the official Nginx docker container
    docker pull nginx
  2. You will need a docker network for confluence and nginx
    docker network create confserver
  3. Create the Confluence container with proxy tages
    docker run \
    --name="confluence" -d \
    -p 8090:8090 \
    -p 8091:8091 \
    -v ~/confluence-home/confluence-docker:/var/atlassian/application-data/confluence \
    -e CATALINA_CONNECTOR_PROXYNAME=test.myapp.com \
    -e CATALINA_CONNECTOR_PROXYPORT=443 \
    -e CATALINA_CONNECTOR_SCHEME=https \
    -e CATALINA_CONNECTOR_SECURE=false \
    --network confserver \
    atlassian/confluence-server
  4. Create the Nginx container in the same confserver network as Confluence
    docker run \
    --name="nginx" -d \
    -p 443:443 \
    --network confserver \
    -v ~/dockerdata/nginx/conf:/etc/nginx/conf.d/ \
    -v ~/dockerdata/nginx/ssl:/mnt \
    nginx
  5. Stop Nginx container, create the SSL certificate/key pair and default.conf then copy them to the host volume accordingly
    docker stop nginx
    cp confluence.key ~/dockerdata/nginx/ssl
    cp confluence.crt ~/dockerdata/nginx/ssl
    cp default.conf ~/dockerdata/nginx/conf

Now start Nginx and you should be able to access the Confluence container via port 443 https://test.myapp.com.

Lastly, here is my Nginx https configuration in default.conf:

server {
    listen          443;
    server_name     test.myapp.com;
    
    ssl                     on;
    ssl_certificate         /mnt/confluence.crt;
    ssl_certificate_key     /mnt/confluence.key;
    ssl_session_timeout     5m;
    ssl_protocols           TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers             HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;
    
    location / {
        client_max_body_size 100m;
        # We need FQDN name here <docker_container_name>.<docker_network_name>
        proxy_pass          http://confluence.confserver:8090/;
        proxy_set_header    X-Forwarded-Host $host;
        proxy_set_header    X-Forwarded-Server $host;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        #proxy_set_header    X-Real-IP $remote_addr;
        #proxy_redirect      off;
    }

    location /synchrony {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://confluence.confserver:8091/synchrony;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
     }
 }

Hope this information helps!

Best Regards.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

402 views 23 8
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you