# Getting an SSL certificate

> Before continuing, make sure your domain and associated web application works well. Access your domain name and test your app using Postman if necessary!

**Using Google Chrome**, go to your CloudFlare page and click on the "**Crypto**" tab in the top menu. Here is where we'll generate the SSL certificate. Other browsers may or may not work for the generation of the SSL certificate and key.

In the **Origin Certificates** section, press **Create Certificate**.

Leaving everything as the default, press **Next**.

You should then see a screen as the below:

![](/files/-LAO7uBsJAhNmTyw2P81)

These are the SSL certificate key and pem files, which the server needs to enable HTTPS.

## Copying the files into the server

Log in to your DigitalOcean server via SSH. This can be done as we have already seen, using a console window, or via the DigitalOcean control panel.

Here, I will create two files. Make sure to replace the domain name for your own:

* `/var/www/ssl/rest-api-course-trial.com.pem` ; and
* `/var/www/ssl/rest-api-course-trial.com.key`.

In each, paste the corresponding text from the CloudFlare SSL certificate generation window. In the `.pem` file paste the **Origin Certificate** field contents, and in the `.key` file paste the **Private Key** field contents.

Voilà! You have an active, signed SSL certificate in your server!

The last thing remaining is to tell nginx to use the SSL certificate and serve traffic via `https`. Let's do that!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://books.tecladocode.com/rest-apis-with-flask-and-python/domains-and-https/getting-an-ssl-certificate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
