# Ports 443/80 show as closed after installation

**URL:** <https://meta.discourse.org/t/ports-443-80-show-as-closed-after-installation/304600>\
**Category:** Self-hosting\
**Created:** [April 19, 2024, 10:06am UTC](https://meta.discourse.org/t/ports-443-80-show-as-closed-after-installation/304600 "2024-04-19T10:06:02Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![Marek\_Wojtaszek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marek_wojtaszek/32/380033_2.png) [@Marek\_Wojtaszek](https://meta.discourse.org/u/Marek_Wojtaszek)\
**Post date:** [April 20, 2024, 4:35pm UTC](https://meta.discourse.org/t/ports-443-80-show-as-closed-after-installation/304600/12 "2024-04-20T16:35:55Z")

</div>

After a long struggle I managed to fix it finally.

**Here is what needs to be done:**  
From the SSH session run the following command to find the container IDs or names:

`docker ps`

Use the following command to access the docker’s container’s shell

`docker exec -it [container_id or name] bash`

Export the Cloudflare API key and email as environment variables. This is to allow ‘acme.sh’ script to authenticate with Cloudflare’s API to create and remove DNS records needed for the DNS challenge. I used my actual email address and Global API Key from your Cloudflare account.

```plaintext
export CF_Key="your_cloudflare_global_api_key"
export CF_Email="your_cloudflare_email_address"

```

Change directory to the following:

`cd /shared/letsencrypt`

Run `acme.sh` with the `--issue` command, specifying that you want to use the dns\_cf (DNS Cloudflare) mode for handling DNS challenges. Replace `yourdomain.com` with the domain for which you want the certificate.

`./acme.sh --issue --dns dns_cf -d yourdomain.com -d *.yourdomain.com`

After succesful cert creation the script will display what directory it was copied to. In my case it was:

```plaintext
Your cert is in: /root/.acme.sh/sprawy.info.pl_ecc/sprawy.info.pl.cer
Your cert key is in: /root/.acme.sh/sprawy.info.pl_ecc/sprawy.info.pl.key
The intermediate CA cert is in: /root/.acme.sh/sprawy.info.pl_ecc/ca.cer
And the full chain certs is there: /root/.acme.sh/sprawy.info.pl_ecc/fullchain.cer

```

Edit the discourse.conf file to update the path to the cert:

`nano /etc/nginx/conf.d/discourse.conf`

The existing ssl\_certificate and ssl\_certificate\_key lines should be replaced with:

```plaintext
ssl_certificate /root/.acme.sh/sprawy.info.pl_ecc/sprawy.info.pl.cer;
ssl_certificate_key /root/.acme.sh/sprawy.info.pl_ecc/sprawy.info.pl.key;

```

So that it now is pointing to the new cert locations.

Run this to test the configuration:

`nginx -t`

If no errors-- reload the web server:

`nginx -s reload`

And-- voila!

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/8/3/d83573f5f99e4bcad1fdd4c2c73fbce4ee166166.png)

---

_[View the full topic](https://meta.discourse.org/t/ports-443-80-show-as-closed-after-installation/304600)._
