> For the complete documentation index, see [llms.txt](https://mabuxi.gitbook.io/mabuxi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mabuxi.gitbook.io/mabuxi/jian-li-ji-shu-zhan/nginx.md).

# Nginx

## How to set up SSL with nginx

I'm using **Comodo PositiveSSL** service inside **Namecheap** website.&#x20;

So, first we need to activate PositiveSSL online, just following the instructions given by Namecheap.

{% hint style="info" %}
To do that, you will need a .csr file. It's a certificate signing request (CSR).

To generate .csr file:

$ openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr
{% endhint %}

&#x20;Then, PositiveSSL will give us a .zip file containing *yourdomain.csr*, *yourdomain.ca-bundle*, and *yourdomain.p7b*. We concatenate *yourdomain.ca-bundle* to *yourdomain.csr* to get a new file called *ssl-bundle.csr*. Hence, this file contains all the certificate information from our side to the root CA side.

After that, we can follow <https://support.comodo.com/index.php?/Knowledgebase/Article/View/1091/0/certificate-installation--nginx>

{% hint style="info" %}

```
Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
```

{% endhint %}

Also, If your server is **Node.js**, you should add `location / { proxy_pass http://localhost:3000; }` to the https server block. `proxy_pass` simply tells **Nginx** to forward requests to `/`  to the server listening on  `http://localhost:3000`.
