<p>The easiest way to renew the certificates is <code>nitro restart</code> (specifically on the <code>nitro-proxy</code> container) which is <a href="https://github.com/craftcms/nitro/issues/311#issuecomment-805791491" rel="nofollow noreferrer">detailed here</a>. Nitro uses Caddy Server as a reverse proxy that runs in its own container and handles generating and terminating local certificates and forwards to the site container to the sites port.</p>
<blockquote>
<p>Also the creator of Caddy chimed in on the same issue on how <a href="https://github.com/craftcms/nitro/issues/311#issuecomment-815990821" rel="nofollow noreferrer">browsers can hold onto certificates longer than needed</a>.</p>
</blockquote>
<p>We also have an architecture overview on the <a href="https://craftcms.com/docs/nitro/2.x/how-nitro-works.html#architecture" rel="nofollow noreferrer">documentation site here</a> that have a better overview of how Nitro works.</p>
<p>If you run <code>nitro restart</code> and the certificates have not been renewed, can you try another browser (or private window) and if that still does not work please create an issue so we can work on getting it resolved!</p>

CC BY-SA 4.0
2021-07-17T11:07:44.243Z
Thanks Jason, I will refer to this if the problem arises again.
Jonathan Schofield
CC BY-SA 4.0
2021-07-13T18:12:04.717Z
2021-07-13T19:52:56.657Z
2021-07-13T19:52:56.657Z
Jason McCallister
<p>While <code>self-update</code> worked for you, that command is used for updating nitro itself. This may have the side-effect of updating your container, but if nitro is already up-to-date it may not do anything. However, the documentation lists multiple commands that are used to update your containers and environment:</p>
<ul>
<li><a href="https://craftcms.com/docs/nitro/2.x/commands.html#update" rel="nofollow noreferrer"><code>nitro update</code></a> updates containers to their latest version.</li>
<li><a href="https://craftcms.com/docs/nitro/2.x/commands.html#init" rel="nofollow noreferrer"><code>nitro init</code></a> initializes or reconfigures the environment, presumably also refreshing the certificates.</li>
<li><a href="https://craftcms.com/docs/nitro/2.x/commands.html#trust" rel="nofollow noreferrer"><code>nitro trust</code></a> installs the root certificates required for browsers to trust self-provisioned certificates (might be necessary after an update).</li>
</ul>
<p>Beyond that, docker containers are there specifically to be ephemeral, so destroying and recreating them should never be a problem.</p>

CC BY-SA 4.0
2021-07-13T15:31:17.050Z
Thanks Moritz. All makes good sense :)
Jonathan Schofield
CC BY-SA 4.0
2021-07-13T15:28:44.060Z
2021-07-13T15:28:44.060Z
MoritzLost
<p>Someone may have a better answer but what just worked for me was:</p>
<pre><code>nitro self-update
</code></pre>
<p>Followed by a Docker reboot.</p>
<p><a href="https://craftcms.com/docs/nitro/2.x/updating.html#macos-linux-and-windows-self-update" rel="nofollow noreferrer">See the docs on updating</a>.</p>

CC BY-SA 4.0
2021-07-13T15:21:44.780Z
2021-07-13T15:21:44.780Z
Jonathan Schofield
<p>I created a Docker container 3 months ago. I’ve only just come back to it and find its SSL certificate has expired.</p>
<p>I can find nothing on what is best to do.</p>
<p>Is it best to reissue the certificate? If so how?</p>
<p>Or should I junk the container and recreate it?</p>
<p>Or something else?</p>

<ssl><nitro><docker>
SSL certificate for Docker container in Nitro 2 has expired: what to do?
# SSL certificate for Docker container in Nitro 2 has expired: what to do?

(Asked by: username_0 on 2021-07-13)

I created a Docker container 3 months ago. I’ve only just come back to it and find its SSL certificate has expired.

I can find nothing on what is best to do.

Is it best to reissue the certificate? If so how?

Or should I junk the container and recreate it?

Or something else?

**Tags:** ssl, nitro, docker


---

## 3 answers

### Answer by username_1 on 2021-07-13. Score: 3

The easiest way to renew the certificates is `nitro restart` (specifically on the `nitro-proxy` container) which is [detailed here](https://github.com/craftcms/nitro/issues/311#issuecomment-805791491). Nitro uses Caddy Server as a reverse proxy that runs in its own container and handles generating and terminating local certificates and forwards to the site container to the sites port.

> Also the creator of Caddy chimed in on the same issue on how [browsers can hold onto certificates longer than needed](https://github.com/craftcms/nitro/issues/311#issuecomment-815990821).

We also have an architecture overview on the [documentation site here](https://craftcms.com/docs/nitro/2.x/how-nitro-works.html#architecture) that have a better overview of how Nitro works.

If you run `nitro restart` and the certificates have not been renewed, can you try another browser (or private window) and if that still does not work please create an issue so we can work on getting it resolved!

> **Comments:**
> **username_0**: Thanks Jason, I will refer to this if the problem arises again.  

---

### Answer by username_2 on 2021-07-13. Score: 3

While `self-update` worked for you, that command is used for updating nitro itself. This may have the side-effect of updating your container, but if nitro is already up-to-date it may not do anything. However, the documentation lists multiple commands that are used to update your containers and environment:

* [`nitro update`](https://craftcms.com/docs/nitro/2.x/commands.html#update) updates containers to their latest version.
* [`nitro init`](https://craftcms.com/docs/nitro/2.x/commands.html#init) initializes or reconfigures the environment, presumably also refreshing the certificates.
* [`nitro trust`](https://craftcms.com/docs/nitro/2.x/commands.html#trust) installs the root certificates required for browsers to trust self-provisioned certificates (might be necessary after an update).

Beyond that, docker containers are there specifically to be ephemeral, so destroying and recreating them should never be a problem.

> **Comments:**
> **username_0**: Thanks Moritz. All makes good sense :)  

---

### Answer by username_0 on 2021-07-13. Score: 1

Someone may have a better answer but what just worked for me was:
nitro self-update

Followed by a Docker reboot.
See the docs on updating.


---

