# Let's Encrypt - certbot / NGINX port conflict

**URL:** <https://community.nginx.org/t/lets-encrypt-certbot-nginx-port-conflict/2606>\
**Category:** NGINX\
**Tags:** docker, lets-encrypt, reverse-proxy\
**Created:** [April 30, 2025, 7:02am UTC](https://community.nginx.org/t/lets-encrypt-certbot-nginx-port-conflict/2606 "2025-04-30T07:02:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Merlin123](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@Merlin123](https://community.nginx.org/u/Merlin123)\
**Post date:** [April 30, 2025, 7:02am UTC](https://community.nginx.org/t/lets-encrypt-certbot-nginx-port-conflict/2606/1 "2025-04-30T07:02:53Z")

</div>

I’m running nginx in Docker.  
I managed to get Let’s Encrypt certificates via certbot.

sudo certbot certonly --nginx -d [my.domain.de](http://my.domain.de)

To get the certificates I had to stop the Nginx container, because it uses ports 80 & 443.  
After getting the certificates the container didn’t start because a process nginx blocked both ports. After killing these processes, the container started again.  
But now the certificate renewal is not working because the Nginx container blocks the ports.

How can I solve this issue?

---

<div class="post-metadata">

**Author:** ![ServiceGuards](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/serviceguards/32/1522_2.png) [@ServiceGuards](https://community.nginx.org/u/ServiceGuards)\
**Post date:** [April 30, 2025, 5:03pm UTC](https://community.nginx.org/t/lets-encrypt-certbot-nginx-port-conflict/2606/2 "2025-04-30T17:03:32Z")

</div>

This is what I would do:

Map the Let’s Encrypt certificate directory into your Nginx container:

```auto
volumes:
  - /etc/letsencrypt:/etc/letsencrypt

```

Update your Nginx configuration to use these paths:

```auto
ssl_certificate /etc/letsencrypt/live/my.domain.de/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/my.domain.de/privkey.pem;

```

Set up certbot to use the webroot plugin instead of the nginx plugin:

```auto
certbot renew --webroot -w /path/to/webroot

```

---

<div class="post-metadata">

**Author:** ![Merlin123](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@Merlin123](https://community.nginx.org/u/Merlin123)\
**Post date:** [May 1, 2025, 10:55am UTC](https://community.nginx.org/t/lets-encrypt-certbot-nginx-port-conflict/2606/3 "2025-05-01T10:55:26Z")

</div>

Thanks, will try it

---

<div class="post-metadata">

**Author:** ![AlbertoC1](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@AlbertoC1](https://community.nginx.org/u/AlbertoC1)\
**Post date:** [May 27, 2025, 4:19pm UTC](https://community.nginx.org/t/lets-encrypt-certbot-nginx-port-conflict/2606/4 "2025-05-27T16:19:59Z")

</div>

Thank you this is work for me..

---

<div class="post-metadata">

**Author:** ![system](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/system/32/19_2.png) [@system](https://community.nginx.org/u/system)\
**Post date:** [July 15, 2025, 9:07pm UTC](https://community.nginx.org/t/lets-encrypt-certbot-nginx-port-conflict/2606/5 "2025-07-15T21:07:01Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
